Last active
July 1, 2019 09:32
-
-
Save hoangtranson/e93bc0c3eebd8e4d24ff3c2e01e6d501 to your computer and use it in GitHub Desktop.
Accessing URL parameter in Angular
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { RouterModule, Routes } from '@angular/router'; | |
import { DashboardComponent } from './dashboard/dashboard.component'; | |
import { HeroesComponent } from './heroes/heroes.component'; | |
import { HeroDetailComponent } from './hero-detail/hero-detail.component'; | |
const routes: Routes = [ | |
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' }, | |
{ path: 'dashboard', component: DashboardComponent }, | |
{ path: 'detail/:id', component: HeroDetailComponent }, | |
{ path: 'heroes', component: HeroesComponent } | |
]; | |
@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