我有一个侧栏组件,其中包含一个可变用户
export class SidebarComponent {
user = JSON.parse(localStorage.getItem('profile'));
constructor(private service: AuthService) {
this.user = this.service.profileUpdated$.subscribe(profile => {
this.user = profile;
});
}
如何将此user
变量传递给另一个组件?我是Angular2的新手