Skip to content

Instantly share code, notes, and snippets.

@fredrik-lundin
Last active March 29, 2017 06:23
Show Gist options
  • Save fredrik-lundin/aae47a71589c46d9944b428212acf568 to your computer and use it in GitHub Desktop.
Save fredrik-lundin/aae47a71589c46d9944b428212acf568 to your computer and use it in GitHub Desktop.
Routing
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { BlueComponent } from 'app/blue/blue.component';
import { RedComponent } from 'app/red/red.component';
const routes: Routes = [
{
path: '',
children: [
{
path: 'red',
component: RedComponent
},
{
path: 'blue',
component: BlueComponent
},
]
},
{
path: '**',
redirectTo: '/'
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment