The "decorator" in question appears in the following block.
@NgModule({
declarations: [
AppComponent,
MyNavComponent,
FirstPageComponent,
SecondPageComponent,
ThirdPageComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
LayoutModule,
MatToolbarModule,
MatButtonModule,
MatSidenavModule,
RouterModule.forRoot(appRoutes),
MatIconModule,
MatListModule
],
providers: [],
bootstrap: [AppComponent]
})
The example is my understanding of the way to import the RouterModule into the application described in the tutorial, Angular Material And Angular 6 – Material Design For Angular.
The messages generated by the trsnspiler, running in my local development server, follow.
Date: 2018-06-03T19:57:21.828Z - Hash: 46428b505e290e79e66d - Time: 632ms 4 unchanged chunks chunk {main} main.js, main.js.map (main) 15.3 kB [initial] [rendered] i 「wdm」: Compiled successfully. ERROR in src/app/app.module.ts(14,1): error TS1206: Decorators are not valid here.
I posted the whole application, minus the node_modules directory, is in StringMorph_20180603_151629.zip, on my OneDrive.
What nuance, obvious to all but me, did I overlook?
This answer appears to be correct. The export class statement must immediately follow any decorator such as @Injectable, @NgModule, etc. The last two lines of your block above should be:
})
export class ModuleName { }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With