1 回答
TA貢獻(xiàn)1946條經(jīng)驗(yàn) 獲得超4個(gè)贊
該組件似乎沒(méi)有看到更改。我不知道為什么,因?yàn)閨異步將完成這項(xiàng)工作。
但要修復(fù)它,您可以使用ChangeDetector:
constructor(
private route: ActivatedRoute,
private encyService: EncyclopediaService
private changeDetectorRef: ChangeDetectorRef,
) {
this.entries$ = encyService.entries$;
this.categories$ = encyService.categories$;
this.entries$.subscribe(es => {
// setTimeout need to run without troubles with ng changes detector
setTimeout(_=>{this.changeDetectorRef.detectChanges()},0);
...
});
或者你可以使用markforCheck,就像那里描述的那樣。
添加回答
舉報(bào)
