本文整理匯總了TypeScript中aurelia-router.Router類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Router類的具體用法?TypeScript Router怎麽用?TypeScript Router使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Router類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: prepare
prepare() {
if (this.router.isConfigured) {
return;
}
this.router.configure((config: RouterConfiguration) => {
config.title = 'Aurelia';
config.map([
{ route: ['', 'login'], name: 'login', moduleId: 'login' },
{ route: 'page1', name: 'page1', moduleId: 'page1', settings: { auth: true } },
{ route: 'page2', name: 'page2', moduleId: 'page2', settings: { auth: true } }
]);
config.addAuthorizeStep(AuthPlugin);
return config;
});
let callback = (eventArgs: Object, name) => {
logger.warn(eventArgs['instruction']['config']['name'], name);
};
this.eventAggregator.subscribe('router:navigation:processing', callback);
this.eventAggregator.subscribe('router:navigation:error', callback);
this.eventAggregator.subscribe('router:navigation:canceled', callback);
this.eventAggregator.subscribe('router:navigation:success', callback);
this.eventAggregator.subscribe('router:navigation:complete', callback);
}
示例2: constructor
constructor(public router: Router) {
router.configure(config => {
config.title = 'TinyUI';
config.map([
{ route: ['','examples'], moduleId: './examples', nav: true, title:'examples' }
]);
});
}
示例3: constructor
constructor(private router: Router) {
this.router.configure(config => {
config.title = "Teatr";
config.map([
{ route: ["", "home"], name: "home", moduleId: "views/home", nav: true, title: "Home" },
{ route: "manage", name: "manage", moduleId: "views/manage", nav: true, title: "Manage" }
]);
return config;
});
}
示例4: loadRouter
private loadRouter() {
this.router.configure((config: RouterConfiguration): RouterConfiguration => {
config.title = "Aurelia";
config.map([
{ route: ['', 'dash'], name: 'dash', moduleId: './views/dashboard/dash', nav: true, title: 'Dashboard' },
]);
return config;
});
}
示例5: constructor
constructor(private router: Router) {
this.router = router;
this.router.configure(config => {
config.title = 'Aurelia';
config.map([
{ route: ['','welcome'], moduleId: './welcome', nav: true, title:'Welcome' },
{ route: 'flickr', moduleId: './flickr', nav: true },
{ route: 'child-router', moduleId: './child-router', nav: true, title:'Child Router' }
]);
});
}
示例6: activeNavItemChanged
activeNavItemChanged(activeNavLink) {
for (let index = 0; index < this.navItems.length; index++) {
let navItem = this.navItems[index];
navItem.isActive = navItem.link === activeNavLink;
}
this.router.navigate(activeNavLink);
}
示例7: save
public save() {
if (!this.canSave) {
return;
}
this.storage.saveTodo(this.todo);
this.router.navigateToRoute('list');
}
示例8:
return this.ds.login().then(user => {
if (user) {
this.session.setUser(user);
return this.router.navigateToRoute("dispatch");
} else {
return true;
}
});
示例9: alert
this.ds.login(this.username, this.password).then(user => {
if (user) {
this.session.setUser(user);
this.router.navigateToRoute("dispatch");
} else {
alert("Username oder Passwort falsch");
}
});