AngularJS:查看观察列表

时间:2016-03-03 11:45:44

标签: angularjs

我想investigate the content of the Watch List,看看哪些物品在里面被观看。这是可能的,我怎么能实现这一目标?请考虑以下代码:

<html ng-app="scopeExample">

<div ng-controller="MyController">
  Your name:
    <input type="text" ng-model="username">
    <button ng-click='sayHello()'>greet</button>
  <hr>
  {{greeting}}
</div>

<script>
angular.module('scopeExample', [])
.controller('MyController', ['$scope', function($scope) {
  $scope.username = 'World';

  $scope.sayHello = function() {
    $scope.greeting = 'Hello ' + $scope.username + '!';
  };
}]);
</script>   

</html>

1 个答案:

答案 0 :(得分:0)

是的,您可以使用

$scope.$$watchers