Angular 2 Change Detection and Zone are Different in Cordova App

前端 未结 1 1823
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-12 18:20

We are building an application using Cordova and Angular 2. I have the following code:

    import { Component, OnInit, ChangeDetectorRef, NgZone } from \'@an         


        
1条回答
  •  孤城傲影
    2021-01-12 18:39

    zone.js patches XHR object and other apis like setInterval, addEventListener, Promise so angular is notified when something happens and it triggers change detection itself.

    It looks like JSONStore is using different Promise implementation (jQuery?) which is not patched by zone.js, so you have to trigger change detection manually or wrap you callbacks in zone.run.

    0 讨论(0)
提交回复
热议问题