Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/462.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在输入字段中添加$watcher?_Javascript_Jquery_Html_Angularjs - Fatal编程技术网

Javascript 如何在输入字段中添加$watcher?

Javascript 如何在输入字段中添加$watcher?,javascript,jquery,html,angularjs,Javascript,Jquery,Html,Angularjs,记住ng change,我想看看如何为输入字段编写一个基本的watch函数 例如,如何将手表应用于以下输入字段 <span class="dropdown-text"> Col <input type="text" value='tiledata.col' ng-model="tiledata.col" class="input-col" id="aeS-Col" ng-click="vm.setInputCol()"> Row <input typ

记住ng change,我想看看如何为输入字段编写一个基本的watch函数

例如,如何将手表应用于以下输入字段

<span class="dropdown-text">
    Col <input type="text" value='tiledata.col' ng-model="tiledata.col" class="input-col" id="aeS-Col" ng-click="vm.setInputCol()">
    Row <input type="text" value='tiledata.row' ng-model="tiledata.row" class="input-row" id="aeS-Row" ng-click="vm.setInputRow()">     
    <i class= "fa fa-arrows"></i>
</span> 

上校
一行

这里有两个输入字段。这对你有用吗

$scope.$watch('tiledata.col', function(newValue, oldValue) {
    alert('The new value of the input is ' + newValue);
});