ranyeli
9/27/2017 - 3:49 AM

Module for routes

Allow to match a route/link to a given component to display it within the router-outlet tag

import {NotFoundComponent} from '../components/not-found/not-found.component';
import {Page1Component} from '../components/page1/page1.component';
import {Page2Component} from '../components/page2/page2.component';
import {Page3Component} from '../components/page3/page3.component';
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {RouterModule, Routes} from '@angular/router';


const appRoutes: Routes = [
  {path: 'first', component: Page1Component},
  {path: 'second', component: Page2Component},
  {path: 'third', component: Page3Component},
  {path: '', redirectTo: '/third', pathMatch: 'full'},
  {path: '**', component: NotFoundComponent}
];

@NgModule({
  imports: [
    CommonModule,
    RouterModule.forRoot(appRoutes)
  ],
  exports: [
    RouterModule
  ],
  declarations: []
})
export class AppRoutesModule {}