angularjs - How can I tell what is calling one of my scope functions in angular? -
i have directive has template such as:
<div ng-show="isvisible()"> ... </div>
i've changed isvisible returns true , console.log.
this directive included single time on page, yet log occurs 50+ times. want know code calling isvisible many times. there way trace calling function? actual stack trace useless, because angular appears hide everything. there tool figure out non-angular code triggered function call.
in other cases have data changing , can't find it's changing [it's not code] , because original code in angular, can't use stack traces, or use watches or normal type of debugging.
here directive:
require('app').directive('kmformlanguages', ["$q", function ($q) { return { restrict: 'eac', template: '<span ng-show="isvisible()"><span km-select multiple ng-model="binding" binding-type="string" placeholder="available languages" items="locales|orderby:\'name\'" minimum="1"></span></span>', transclude: true, scope: { binding : '=ngmodel', }, controller: ["$scope", "istorage", "editformutility", function ($scope, storage, editformutility) { $scope.locales = [ {identifier:"ar", name:"arabic" }, {identifier:"en", name:"english" }, {identifier:"es", name:"spanish" }, {identifier:"fr", name:"french" }, {identifier:"ru", name:"russian" }, {identifier:"zh", name:"chinese" } ]; $scope.isvisible = function() { console.log('binding: ', $scope.binding); debugger; return $scope.binding!==undefined && $scope.binding!==null; } }] }; }])
and html uses (no angular controls ancestors shown):
<div ng-controller="editmeasure"> [...] <div ng-show="!isloading() && status!='hidden'"> [...] <span km-form-languages ng-model="document.header.languages"></span>
it hard text. if can post sample code, more accurate answers can given.
but have described, seems function being called part of angular js
$digest or $compile
cycle.
Comments
Post a Comment