Angular2 ngModelChange previous value

前端 未结 4 1546
醉酒成梦
醉酒成梦 2020-12-25 11:13

Is there a way to get the previous(last) value of a field on ngModelChange? What I have goes something like this

HTML



        
4条回答
  •  天涯浪人
    2020-12-25 11:41

    What you can do is,

    DEMO : http://plnkr.co/edit/RXJ4D0YJrgebzYcEiaSR?p=preview

     
    
    private textChanged(event) {        
        console.log('changed', this.text, event);
        this.text=event;                          //<<<###added 
    }
    

提交回复
热议问题