angular5订阅之一 Subject()

在 service里面 

public isShowSubject: Subject<Object> = new Subject();
通过service 
this.Service.isShowSubject.next(数据);
在其他组件中使用 
this.Service.isShowSubject.subscribe((data) => {
  console.log(data);
}
posted @ 2018-12-19 14:24  前端小厨-美食博主  阅读(2448)  评论(0编辑  收藏  举报