jquery - How to get `callback` from other element animation completion, not from self directive -
on click of element, doing animation other element (say sibling) how callback
sibling scope
function?
here code :
var myapp = angular.module('myapp', ['nganimate']); myapp.controller('count', function($scope) { $scope.flag=true; $scope.animate = function () { $scope.flag = !$scope.flag; } });
$animate
service may used handle enter
, leave
callbacks.
you have used ng-if
show/hide content in example ng-if
doesn't have hooks pass callback in. you'll have write own directive(say animated-if
) , provide custom hooks pass callbacks(animated-if-leave-callback
, animated-if-enter-callback
).
to fire event after ng-leave, use $animate.leave(element, scope.leaveonclick)
the enter 1 bit more complicated not call callback on initial loading of directive.
var callback = !oldvalue && $scope.animatedifentercallback ? $scope.animatedifentercallback : (function() {}); $animate.enter(clone, $element.parent(), $element, callback);
here's enter link description hereupdated plunkr
Comments
Post a Comment