Professional Documents
Culture Documents
● Modules
● Components
● Templates
● Metadata
● Data binding
● Directives
● Services
● Dependency injection
1.) Decorators are functions that modify JavaScript classes. Angular has many decorators that
attach metadata to classes so that it knows what those classes mean and how they should
work. Learn more about decorators on the web.
declarations - the view classes that belong to this module. Angular has 3 kinds of view
classes: components, directives, and pipes.
● exports - the subset of declarations that should be visible and usable in the component
● imports - other modules whose exported classes are needed by component templates
declared in thismodule.
● providers - creators of services that this module contributes to the global collection of
● bootstrap - the main application view, called the root component, that hosts all other app
views.
Note: Only the root module should set this bootstrap property.
@NgModule({
imports: [ BrowserModule ],
providers: [ Logger ],
declarations: [ AppComponent ],
exports: [ AppComponent ],
bootstrap: [ AppComponent ]
})
Ex.
<ul>
<li *ngFor="let hero of heroes" (click)="selectHero(hero)">
{{hero.name}}
</li>
</ul>
They tend to appear within an element tag as attributes do, sometimes by name but more often as
Structural directives alter layout by adding, removing, and replacing elements in DOM.
Note: you must have previously registered a provider of the HeroService with the injector. A
provider is something that can create or return a service, typically the service class itself.
● Dependency injection is wired into the Angular framework and used everywhere.