angular5订阅之一 Subject()

时间:2018-12-19 15:05:17   收藏:0   阅读:666

在 service里面 

public isShowSubject: Subject<Object> = new Subject();
通过service 
this.Service.isShowSubject.next(数据);
在其他组件中使用 
this.Service.isShowSubject.subscribe((data) => {
  console.log(data);
}

原文:https://www.cnblogs.com/aisiqi-love/p/10142994.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!