I tested Angular 2 with beta, and now with rc.0 + some things have changed.
One of them is RouteParams, which cannot be imported from @ angular / router. And when I try to use @ angular / router-deprecated, I get an error message:
ORIGINAL EXCLUSION: There is no provider for RouteParams!
app.component:
@Routes([ { path: '/', component: StartComponent }, {path: '/:projId/:userName', component: ProjectListComponent}, { path: '*', component: StartComponent }, ])
Project-list.component:
import {Component, OnInit} from '@angular/core'; import {RouteParams} from '@angular/router-deprecated'; @Component({ ... }) export class ProjectListComponent implements OnInit { userName:string; projId:string; constructor(private params:RouteParams) { this.userName = params.get('userName'); this.projId = params.get('projId'); } }
Where can I import RouteParams from now on, or is it something else I'm doing wrong?
Thanks!
javascript angular angular2-routing
mottosson
source share