我想在使用某种方法更改值时更新文本值,当我仍在输入文本但从文本框退出或通过脚本代码更改它时,该方法不应调用:
<input type="text" ng-model ="model.value" ng-change = "update()"/>
什么应该包含 update() 方法,
我尝试的是:为这个文本框写了一个指令,并且
scope.$watch('model', function(nval,oval){
if ((oVal === undefined) && (nVal != undefined)){
update()
}
});
它是第一次调用,但不是在模型值更改时调用。
我想在 model.value 更改时调用 update 方法,但在输入文本时不调用