Sha*_*zmi 12 angular2-routing angular
我正在使用Angular 4,我想将一些对象传递给路由器但不更新查询参数.
user.component.ts
this.router.navigate(["/profile",{
action: 'edit',
user: {id: 1, name: 'test', email: 'test@mail.com'}
}]);
Run Code Online (Sandbox Code Playgroud)
APP-routing.module.ts
{ path: 'profile', component: UserProfileComponent }
Run Code Online (Sandbox Code Playgroud)
用户profile.component.ts
this.route.params.subscribe(params => {
});
Run Code Online (Sandbox Code Playgroud)
有帮助吗?
以下是如何使用服务共享数据的示例:http://blogs.msmvps.com/deborahk/build-a-simple-angular-service-to-share-data/
归档时间: |
|
查看次数: |
19708 次 |
最近记录: |