如果想在controller里面随时监听一个值的变化那就用$watch
<p> |
<label><strong>$watch:</strong></label> |
<input type="text" ng-model= "name" /> |
</p>
$scope.$watch(
,
function
(newVal,oldVal){
console.log(
"new:"
+newVal,
"old:"
+oldVal)
}); |