本文整理汇总了TypeScript中angular2/router.Router.generate方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Router.generate方法的具体用法?TypeScript Router.generate怎么用?TypeScript Router.generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/router.Router
的用法示例。
在下文中一共展示了Router.generate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: params
/**
* This function initializes attributes.
* You probably don't need to touch this method.
* If the last element is detected as a function,
* _preFunction is initialized.
* @param {any[]} changes - inputs value, don't
* worry about it.
*/
set params(changes: any[]) {
if(typeof(changes[changes.length-1]) === "function") {
this._preFunction = changes.pop();
}
this._routeParams = changes;
this._navigationInstruction = this._router.generate(this._routeParams);
}
示例2: createDossier
public createDossier(customer) {
const instructions = this._router.generate(['/Customer', {
id: customer.partnerId
}]);
const caption = `Kunde: ${customer.vorname} ${customer.name}`;
const dossiers = this._dossierService.getAll();
const dossier = dossiers.find(d => d.caption === caption);
if (!dossier) {
this._dossierService.createDossier(instructions, caption);
}
}
示例3: navigateToMailbox
public navigateToMailbox() {
this._interactionService.requestSave();
let caption = 'Briefkasten',
instructions = this._router.generate(['/Mailbox']);
const dossiers = this._dossierService.getAll();
const dossier = dossiers.find(d => d.caption === caption);
if (!dossier) {
this._dossierService.createDossier(instructions, caption);
}
this._router.navigateByInstruction(instructions);
}
示例4: isRouteActive
isRouteActive(pRoute:String){
let instruction = this._router.generate([pRoute]);
return this._router.isRouteActive(instruction);
}
示例5: isCurrentRoute
isCurrentRoute(routeName){
var instruction = this._router.generate(routeName);
return this._router.isRouteActive(instruction);
}
示例6: params
set params(changes: any[]) {
this._routeParams = changes;
this._navigationInstruction = this._router.generate(this._routeParams);
}
示例7: navigatePage
navigatePage(id) {
let instruction = this.router.generate(['../PostsPage', { id: id }]);
this.router.navigateByInstruction(instruction);
}
示例8: isCurrentRoute
isCurrentRoute(route) {
// obsolete in current version, use RouterLinkActive directive!
// https://angular.io/docs/ts/latest/api/router/index/RouterLinkActive-directive.html
var instruction = this._router.generate(route);
return this._router.isRouteActive(instruction);
}
示例9: isCurrentRoute
isCurrentRoute(route){//get current route
var instruction = this._router.generate(route);
return this._router.isRouteActive(instruction);
}
示例10: isRouteActive
isRouteActive(route) {
var instruction = this._router.generate([route]);
return this._router.isRouteActive(instruction);
}