angularjs - Add class later request was completed with Angular loading bar -


i'm working frontend angular , angular-loading-bar, in controller put code.

$rootscope.$on("cfploadingbar:completed",function(){    $(".animated").addclass("fadein"); }); 

or

$scope.$on("cfploadingbar:completed",function(){    $(".animated").addclass("fadein"); }); 

when xhr requests have returned, want add clase in section content, code inside event don't run.

how correct way achieve it?

firstly, check use appropriate event name. example, sure thet name cfploadingbar:completed? maybe cfploadingbar::completed (its common pattern) or else?

second, ensure have subscribe event using $rootscope. maybe have subscribe in concrete controller witj own $scope?

and big suggestion: do not use jquery , angular in code, not mess up!!! angular has built in possibility work jquery. need call angular.element() returns element if use jquery. in case can write angular.element(".animated").addclass("fadein"); , same thing, in angular way


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -