本文整理匯總了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);
}