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