Angular 2 ngModelChange 旧值 [英] Angular 2 ngModelChange old value

查看:24
本文介绍了Angular 2 ngModelChange 旧值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我比较 ngModel 旧值和新值的最佳做法是什么?

Can someone please tell me what is the best practice for comparing ngModel old and new value?

在角度 1 中:

$scope.$watch('someProperty', funciton(oldVal, newVal){
    // code goes here
})

我问这个是因为 (ngModelChange) 从来没有给我带来 oldVal ,只有 newVal .

I am asking this because (ngModelChange) never brings me the oldVal , only the newVal.

就我而言,我在

发送“验证码”获取 | 15天全站免登陆