Back to Angular Course
Angular Course
What is Decorator?
- Angular decorator store metadata about a class, method property.
- Metadata is data that provides information about other data.
- All decorators are represented with @ symbol.
for example,
app.component.ts
import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrl: './app.component.css' }) export class AppComponent { title = 'Demo'; }
app.module.ts
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
What are the types of Decorator?
