From 4a7f71516264e21b5b03e281d68b508492bbcc19 Mon Sep 17 00:00:00 2001 From: Adrian Mejia Date: Tue, 18 Oct 2016 17:38:29 -0400 Subject: [PATCH] Routing and Navigation --- src/app/app.component.html | 2 +- src/app/app.module.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/app.component.html b/src/app/app.component.html index b530937..90c6b64 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/src/app/app.module.ts b/src/app/app.module.ts index b07c059..fe1359d 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,10 +2,16 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; +import { Routes, RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; import { TodoComponent } from './todo/todo.component'; +const routes: Routes = [ + { path: ':status', component: TodoComponent }, + { path: '**', redirectTo: '/all' } +]; + @NgModule({ declarations: [ AppComponent, @@ -14,7 +20,8 @@ import { TodoComponent } from './todo/todo.component'; imports: [ BrowserModule, FormsModule, - HttpModule + HttpModule, + RouterModule.forRoot(routes) ], providers: [], bootstrap: [AppComponent]