AngularJS animation in directive not running on page load -



AngularJS animation in directive not running on page load -

i have directive triggers animation moves div 200px higher when moving away the / location. works long / location our starting point, when starting route, addclass still reached, not executed.

angular.module('app'). directive('topposition', ['$location', '$animate', '$rootscope', function (location, $animate, $rootscope) { homecoming { restrict: 'a', link: function (scope, element, attrs) { scope.location = location; scope.$watch('location.path()', function (newpath) { if (newpath !== '/') { $animate.addclass(element, 'higher'); } else { $animate.removeclass(element, 'higher'); } }); } } }])

the animation code

angular.module('app') .animation(".higher", function () { homecoming { addclass: function (element, classname, done) { tweenmax.to(element,1, { y: '-200' }); }, removeclass: function (element, classname , done) { tweenmax.to(element, 1, {y: 0}); } } });

what doing wrong here ?

angularjs angularjs-directive angularjs-animation

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -