<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);
})
                            
                                    Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
$watch方法不对