angular adding routing table



Create a file called "app-routing.module.ts" with the following content :-


import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AppComponent } from './app.component';

//This is my case
const routes: Routes = [
{
path: '',
component: AppComponent
},
{
path: 'about',
component: AppComponent
}
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }


Next,  open app.module.ts

import { AppRoutingModule } from './app-routing.module';


And add "AppRoutingModule"


@NgModule({
declarations: [
AppComponent,
CarInsuranceComponent,
HouseInsuranceComponent,
HealthInsuranceComponent,
],
imports: [
BrowserModule,FormsModule,AppRoutingModule,
StoreModule.forRoot(reducers, { metaReducers }),
EffectsModule.forRoot([AppEffects])
],
providers: [],
bootstrap: [AppComponent,]
})
export class AppModule { }

Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm