本文整理汇总了TypeScript中angular2/alt_router.Router类的典型用法代码示例。如果您正苦于以下问题:TypeScript Router类的具体用法?TypeScript Router怎么用?TypeScript Router使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Router类的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}`);
}