我有以下代码在Chrome中不使用this.cdr.detectChanges();
(cdr:ChangeDetectorRef
)
this.channelService.sub(id)
.subscribe(
(x: ChannelEvent) => {
console.log("event received");
switch (x.Name) {
case ChannelEventType.onUpdateStatus:
{
this.updateStatus();
console.log("status updated to " + x.Data.Status);
this.cdr.detectChanges();
}
}
},
(error: any) => {
console.warn("Attempt to join channel failed!", error);
}
);
但在Firefox中,我必须为事件signalR
订阅调用检测更改。请提供一些想法,当视图模型发生变化时,可能会导致Firefox出现问题的更改?