关于Angular2中回调函数与数据绑定不能实时更新的问题
2018-04-11 本文已影响0人
xiao_afei
注入
import { Component,ChangeDetectorRef,NgZone } from '@angular/core';
构造器
constructor(public navCtrl:NavController,public ref: ChangeDetectorRef,private zone:NgZone){
console.info("----login start------");
}
回调函数中
that.user.username="";
that.user.password="";
that.zone.run(()=>{
console.log('enabled time travel');
})