Modules are imported in app.module.ts, by adding an entry below,
@NgModule({
declarations: [
AppComponent,
HomeComponent,
DirectoryComponent,
FilterPipe,
LoggingService
],
imports: [
FormsModule,
BrowserModule,
HttpClientModule,
routing
],
providers: [],
bootstrap: [AppComponent]
})
but RouterModule is directly used in ../src/app/app.routes.ts, as shown below,
import {Routes, RouterModule} from "@angular/router";
export const routes:Routes = [
/* Each route will be an object {}*/
{path: 'directory', component: DirectoryComponent},
{path: '', component: HomeComponent}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
There is no entry of RouterModule in @NgModule(imports: [..]).
1) Are there different ways to import an angular module?
2) Is import of angular module different from import of typescript module?
@NgModuleyou declared.