本文整理汇总了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");
}
});