1. 可以在scope中直接使用
// 监听日期变化
$scope.$watch(‘vaFilter.startEffectiveDate‘, function(newDate, oldDate, scope){
if (!angular.isUndefined(newDate)) {
$scope.fromDate = newDate;
}
});
2. 可以直接监视angular以外的js变量
angular.module(‘myModule‘, []).controller(‘MyCtrl‘, function() {
$scope.$watch(‘test‘, function(newVal, oldVal){
//TODO
});
});
var test = "test"; test 为angular之外的js全局变量
原文:http://www.cnblogs.com/nelson-hu/p/7576859.html