美文网首页我爱编程
关于Angular2中回调函数与数据绑定不能实时更新的问题

关于Angular2中回调函数与数据绑定不能实时更新的问题

作者: xiao_afei | 来源:发表于2018-04-11 15:49 被阅读0次

注入

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');

                })

相关文章

网友评论

    本文标题:关于Angular2中回调函数与数据绑定不能实时更新的问题

    本文链接:https://www.haomeiwen.com/subject/bthzhftx.html