jam tangan angular.js tidak dapat mengesan perubahan dalam nilai input
过去多啦不再A梦
过去多啦不再A梦 2017-05-15 17:04:38
0
1
545
<input type="text" name="name" ng-model="inputname" ng-init="inputname='hello'">
       <span>{{inputname}}</span>
    <button type="button" name="button" ng-click="change()">改变值</button>
$scope.change=function(){
 $scope.inputname="world";
}
$scope.$watch("$scope.inputname",function(newValue,oldValue){
   console.log(newValue);
   console.log(oldValue);
   console.log($scope.inputname);
})
过去多啦不再A梦
过去多啦不再A梦

membalas semua(1)
大家讲道理

$watchKaedah yang salah

$scope.$watch('inputname', function(newValue,oldValue){
   console.log(newValue);
   console.log(oldValue);
   console.log($scope.inputname);
})
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan