本文整理匯總了TypeScript中angular2/router.RouteParams類的典型用法代碼示例。如果您正苦於以下問題:TypeScript RouteParams類的具體用法?TypeScript RouteParams怎麽用?TypeScript RouteParams使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了RouteParams類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(routeParams:RouteParams, private pictureservice:PictureService) {
this.id = routeParams.get('id');
}
示例2: constructor
constructor(private _service:BooksService,
private _router:Router,
routeParams:RouteParams) {
this._selectedId = +routeParams.get('id');
}
示例3: constructor
constructor(
private _questionnaireService:QuestionnaireService,
routeParams:RouteParams) {
this._id = routeParams.get('id');
}
示例4: ngOnInit
ngOnInit() {
// Notice how we extract the id by calling the RouteParams.get method.
let id = +this._routeParams.get('id'); // The hero id is a number. Route parameters are always strings. So we convert the route parameter value to a number with the JavaScript (+) operator.
this._heroService.getHero(id)
.then(hero => this.hero = hero);
}
示例5: constructor
constructor(params: RouteParams, phones: Phones) {
phones.getPhone({ phoneId: params.get("phoneId") }).then((phone) => {
this.phone = phone;
this.mainImageUrl = phone.images[0];
});
}
示例6: ngOnInit
ngOnInit():any {
let itemIndex = this._routerParams.get('recipeIndex');
this._recipeIndex = itemIndex;
this.recipe = this._recipeService.getRecipe(+itemIndex) || null;
}
示例7:
_dataService.events$.map(events => events.find(event => event.id === _params.get('id')));
示例8: ngOnInit
ngOnInit() {
// convert the route parameter value to a number with the JavaScript (+) operator.
let id = +this._routeParams.get('id');
this._heroService.getHero(id)
.then(hero => this.hero = hero);
}
示例9: ngOnInit
ngOnInit() {
let id = +this.routeParams.get('id');
this.postService.getPost(id)
.subscribe(post => this.post = post);
}
示例10: ngOnInit
ngOnInit():any {
this.newSoldier = {name: this._routeParams.get('name'), power: null, health: null};
}