0
我有以下管:管與ChangeDetectorRef不被刷新上訂閱事件
{{ "value" | translationPipe | async }}
translationPipe {
constructor(otherService: OtherService, myService: MyService, _ref : ChangeDetectorRef) {
this.myService.myEventEmitter.subscribe(value -> {
_ref.markForCheck();
});
}
transform(value, args?) {
// this returns an api call observable
return this.otherService.doApiCall();
}
}
然而,當事件發射器輸出管的值不reobtained一個事件。
爲什麼你認爲它會被重新評估? – yurzui
@yurzui調用_ref.markForCheck會觸發reavaluation它不會? – mangusbrother
@mangusbrother它標誌着變化檢測的* view *。管道沒有看法。 – cgTag