Angular 2 + SignalR - Accessing Angular internals from external script

喜欢而已 提交于 2019-12-09 03:16:28

To manually run change detection:

  1. Use ApplicationRef::tick() method.
  2. Use NgZone::run() method to wrap you code which should be executed inside angular zone.

You can get them by using dependency injection or by bootstrapping your application using platform().application(bindings).bootstrap(Component):

import { platform } from 'angular2/angular2';

const app = platform().application([] /* - bindings */); // you can use `app.tick()` 
const zone = app.zone; // you can use `zone.run`

app.bootstrap(Component);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!