subject的意义
来源:8-3 http通讯

MrXs
2017-06-13
我想问问 这个subject的意义是什么额。 把一个值s设置为subject类型,通过next触发事件与直接更改值,都可以触发订阅事件吧?
public subject: Subject<User> = new Subject<User>(); this.http.get(URL).map((response: Response) => { let data= response.json(); this.subject.next(data); }); public user: User = new User(); this.http.get(URL).map((response: Response) => { let data = response.json(); this.user=data; });
写回答
2回答
-
MrXs
提问者
2017-06-15
public subject: Subject<User> = new Subject<User>(); this.http.get(URL).map((response: Response) => { let data= response.json(); this.subject.next(data); }); public user: User = new User(); this.http.get(URL).map((response: Response) => { let data = response.json(); this.user=data; });
这两种情况
00 -
JoJo
2017-06-15
什么?没太明白你想问什么,把代码贴出来看看:)
012017-06-15
相似问题