/**
* Invoke this method to explicitly process change detection and its side-effects.
*
* In development mode, `tick()` also performs a second change detection cycle to ensure that no
* further changes are detected. If additional changes are picked up during this second cycle,
* bindings in the app have side-effects that cannot be resolved in a single change detection
* pass.
* In this case, Angular throws an error, since an Angular application can only have one change
* detection pass during which all change detection must complete.
* @return {?}
*/
tick() {
if (this._runningTick) {
throw new Error('ApplicationRef.tick is called recursively');
}
try {
this._runningTick = true;
for (let view of this._views) {
view.detectChanges();
}
if (this._enforceNoNewChanges) {
for (let view of this._views) {
view.checkNoChanges();
}
}
}
catch (e) {
// Attention: Don't rethrow as it could cancel subscriptions to Observables!
this._zone.runOutsideAngular((/**
* @return {?}
*/
() => this._exceptionHandler.handleError(e)));
}
finally {
this._runningTick = false;
}
}在core.js的rootContext属性里,展开Components, 能看到所有AppComponent的属性和值:渲染UI:
下面这是一个非常重要的从Component属性将值移动到UI上的方法:renderer.setProperty:在这里给input的value属性赋的值: