How in angular2 can you get RouteParams for the new @Angular/router - doesnt seem to exist
This is my current code:
import {Component} from '@angular/core';
import {Router, ROUTER_DIRECTIVES, RouteParams} from '@angular/router';
@Component({
moduleId: module.id,
selector: 'NewJob',
templateUrl: 'newJob.html',
directives: [ROUTER_DIRECTIVES, Footer]
})
export class NewJob {
router: Router;
constructor(_router: Router, _params: RouteParams){
let slug = _params.get('slug');
}
}
RouteSegment no longer exists. You can use ActivatedRoute
import:
import {ActivatedRoute} from "@angular/router";
constructor:
constructor(private _routeParams: ActivatedRoute){}
to get the params:
this._routeParams.params.subscribe(params => {
this.id = params['id'];
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With