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
Post a Comment