December 2014
Intermediate to advanced
346 pages
6h 14m
English
The Batarang browser plugin allows you to inspect the application's watch tree, but there are many scenarios where dynamically inspecting the watch list within the console or application code can be more helpful when debugging or making design decisions.
The following function can be used to inspect all or part of the DOM for watchers. It accepts an optional DOM element as an argument.
var getWatchers = function (element) { // convert to a jqLite/jQuery element // angular.element is idempotent var el = angular.element( // defaults to the body element element || document.getElementsByTagName('body') ) // extract the DOM element data , elData = el.data() // initalize returned watchers array , watchers ...Read now
Unlock full access