本文整理汇总了TypeScript中angular2/alt_router.Router.navigateByUrl方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Router.navigateByUrl方法的具体用法?TypeScript Router.navigateByUrl怎么用?TypeScript Router.navigateByUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/alt_router.Router
的用法示例。
在下文中一共展示了Router.navigateByUrl方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: gotoCrises
// #docregion gotoCrises
gotoCrises() {
let crisisId = this.crisis ? this.crisis.id : null;
// Pass along the hero id if available
// so that the CrisisListComponent can select that hero.
// Add a totally useless `foo` parameter for kicks.
// #docregion gotoCrises-navigate
this._router.navigateByUrl(`/crisis-center/${crisisId};foo=foo`);
// #enddocregion gotoCrises-navigate
}
示例2: gotoHeroes
gotoHeroes() {
let heroId = this.hero ? this.hero.id : null;
// Pass along the hero id if available
// so that the HeroList component can select that hero.
// Add a totally useless `foo` parameter for kicks.
// #docregion gotoHeroes-navigate
this._router.navigateByUrl(`/heroes/${heroId};foo=foo`);
// #enddocregion gotoHeroes-navigate
}
示例3: gotoHeroes
// #enddocregion OnActivate
// #docregion gotoHeroes
gotoHeroes() {
// Like <a [routerLink]="['/heroes']">Heroes</a>
this._router.navigateByUrl('/heroes');
}
示例4: gotoCrises
// #enddocregion cancel-save
// #docregion gotoCrises
gotoCrises() {
// Like <a [routerLink]="[/crisis-center/]">Crisis Center</a
this._router.navigateByUrl('/crisis-center/');
}
示例5: onSelect
// #docregion select
onSelect(crisis: Crisis) {
this._router.navigateByUrl( `/crisis-list/${crisis.id}`);
}
示例6: onSelect
// #docregion select
onSelect(hero: Hero) {
// #docregion nav-to-detail
this._router.navigateByUrl( `/heroes/${hero.id}`);
// #enddocregion nav-to-detail
}
示例7: onSelect
// #enddocregion isSelected
// #docregion select
onSelect(hero: Hero) {
this._router.navigateByUrl(`/heroes/${hero.id}`);
}