angularjs - viewContentLoaded event called multiple times for a single TemplateURL ui-router -


i have view

 <div class="wrapper" ui-view>         @renderbody()     </div> 

and state renderes template called _bodylayout

(function () {     angular.module('ngapp').config(configuration);      configuration.$inject = ['$stateprovider'];      function configuration($stateprovider) {          $stateprovider.state('dashboard', {             url: '/dashboard',             templateurl: '/shared/_bodylayout',         });     }  })(angular); 

i have run method template should register plugins once template when rendered :

(function () {     'use strict';     angular.module("ngapp").run(run);      run.$inject = ['$rootscope', 'plugin-factory', '$timeout'];      function run($rootscope, plugins, $timeout) {          $rootscope.$on('$viewcontentloaded', function (event) {              plugins.run();         });     }  })(angular); 

but on console.log shows event runs multiple times , plugins.run() method has been called @ least 5 times single templateurl !!! makes sidebar plugin behave weird .

can tell me why running 5 times instead of 1 time single templateurl ?

enter image description here


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -