2016-06-07 48 views
1

記住ng變化,我想看看如何爲輸入字段寫一個基本的手錶功能。

手錶如何應用於以下輸入字段爲例?

<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> 

回答

1

那麼你有2個輸入字段。這對你有用嗎?

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