本文整理汇总了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};
}