2016-03-03 63 views
0

我想investigate the content of the Watch List,看看裏面有哪些東西要觀看。這是可能的,我如何實現這一目標?考慮下面的代碼:($範圍$$觀察家)AngularJS:看看裏面的手錶列表

<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> 

回答

0

是的,你可以使用

$scope.$$watchers 
+0

通過嘗試''的console.log我得到** **返回null。與上面的代碼有什麼關係,以便查看某些內容? –

+0

請參閱小提琴:http://jsfiddle.net/jqjyvdjx/。請注意,有些空洞的觀察者 - 沒關係。 –