ts1206 decorators are not valid here, Angular 2
The Decorators must come directly before an exported class for example:
@Component({
...
})
export class someComponent{}
this goes the same for @Pipe
@Directive
@Injectable
and @NgModule
This error came to me when I used angular routing and defined routes after @NgModule
decorator.
We need to define routes or any other decorater before the @NgModule
decorator.
const appRoutes: Routes = [ // define this before @NgModule
{ path: '',
redirectTo: '/home',
pathMatch: 'full'
},
{ path: 'home', component: HomeComponent },
];
@NgModule({ // This Decorator should be just before an exported class
declarations: [
AppComponent,
HeaderComponent,
HomeComponent
],
imports: [
BrowserModule,
RouterModule.forRoot(
appRoutes,
{ enableTracing: true } // <-- debugging purposes only
)
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }