本文整理汇总了TypeScript中aurelia-router.Router.navigate方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Router.navigate方法的具体用法?TypeScript Router.navigate怎么用?TypeScript Router.navigate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aurelia-router.Router
的用法示例。
在下文中一共展示了Router.navigate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
this.userService.resetUserPassword(this.userResetPasswordDto).then((result: data.IResult) =>
{
if (result.state === data.ResultStateEnum.Succeed)
{
this.router.navigate('#/user/login');
Materialize.toast('Operation succeed. Login now !', 4000, 'btn');
} else
{
for (let error of result.errors)
Materialize.toast(error, 4000, 'btn orange');
}
});
示例2:
(data: any) =>
{
if ( data.response === 'done' )
{
this.updateData();
this.router.navigate('profile');
}
else
{
this.controller.addError('Old password is wrong.', 'password')
console.log( data )
}
}
示例3:
this.createProjectService.createProject(this.newProject).then((result: data.IResult) =>
{
if (result.state === data.ResultStateEnum.Succeed)
{
Materialize.toast('Project created', 4000, 'btn');
this.router.navigate('#/project/overview');
}
else
{
for (let error of result.errors)
Materialize.toast(error, 4000, 'btn orange');
}
});
示例4: configureRouter
public configureRouter(config: RouterConfiguration, router: Router) {
config.title = 'TaskBo-rd';
config.map([
{ route: ['', 'home'], name: 'home', moduleId: 'home', nav: true, title: 'Home' },
{ route: 'profile', name: 'profile', moduleId: 'profile', nav: true, title: 'Profile', href: 'profile' },
{ route: 'logout', name: 'Logout', moduleId: 'logout', nav: true, title: 'Log Out', href: 'LogOut' },
{ route: 'editProfile', name: 'editProfile', moduleId: 'editProfile', nav: false, title: 'Edit Profile', href: 'editProfile' },
{ route: 'addEditGroup/:id', name: 'addEditGroup', moduleId: 'addEditGroup', nav: false, title: 'Edit Group', href: 'addEditGroup' },
{ route: 'group-tasks/:id', name: 'group-tasks', moduleId: 'group-tasks', nav: false, title: 'Tasks by group', href: 'group-tasks' },
{ route: 'task/:id', name: 'task', moduleId: 'task', nav: false, title: 'View task', href: 'task' },
{ route: 'edit/:id', name: 'editTask', moduleId: 'editTask', nav: false, title: 'Edit task', href: 'editTrask' }
]);
this.router = router;
this.router.navigate('/');
}
示例5: updateProfile
updateProfile()
{
this.controller.reset();
if ( String(this.user.newPass) === String(this.user.repeatPass) )
{
if ( ! String(this.user.newPass) )
{
this.updateData()
this.router.navigate('profile');
}
else
{
this.connect.updateProfilePassword( this.user )
.then(
(data: any) =>
{
if ( data.response === 'done' )
{
this.updateData();
this.router.navigate('profile');
}
else
{
this.controller.addError('Old password is wrong.', 'password')
console.log( data )
}
}
);
}
}
else
{
this.controller.addError('New password doen\'t match.', 'password')
}
}
示例6:
.then((customer) => {
console.log(customer, this.customer.isNew());
return this.router.navigate('list');
});
示例7:
this._ea.subscribe(Events.polymerChosen, () => {
this.router.navigate('polymer');
});
示例8:
this.session.logout().then(loggedOut => {
this.router.navigate("/");
});
示例9:
this.userService.logout().then((result: data.IResult) =>
{
this.authService.clearAccessToken();
this.authService.setUser(null);
this.router.navigate('#/');
});
示例10:
return this.http.delete(`/api/schedulers/${this.schedulerName}/calendars/${this.name}`).then(() => {
toastr.success(`Calendar ${this.name} deleted successfully`);
return this.router.navigate("calendars");
});