Created
May 3, 2014 20:34
-
-
Save jimmont/c64aa6131760eedb6867 to your computer and use it in GitHub Desktop.
transitionEnd attribute directive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
element{transition:height 500ms ease-out;height:10px;} | |
element.change{height:200px;} | |
<element transition-end="endTransition($event)"></element> | |
$scope.endTransition = function(e){ } | |
*/ | |
.directive('transitionEnd', function($parse){ | |
return { | |
restrict: 'A' | |
,link: function(scope,elem,attr){ | |
var expr = $parse(attr.transitionEnd); | |
elem.on('transitionend',function(event){ | |
scope.$apply(function(){ | |
expr(scope, {$event:event}); | |
}); | |
}); | |
} | |
}; | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment