Skip to content

Commit

Permalink
fix(view): fix $animate usage for 1.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleycho committed Sep 14, 2015
1 parent 1f781c8 commit 9b6d9a2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/viewDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,18 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
if ($animate) {
return {
enter: function(element, target, cb) {
var promise = $animate.enter(element, null, target, cb);
if (promise && promise.then) promise.then(cb);
if (angular.version.minor > 2) {
$animate.enter(element, null, target).then(cb);
} else {
$animate.enter(element, null, target, cb);
}
},
leave: function(element, cb) {
var promise = $animate.leave(element, cb);
if (promise && promise.then) promise.then(cb);
if (angular.version.minor > 2) {
$animate.leave(element).then(cb);
} else {
$animate.leave(element, cb);
}
}
};
}
Expand Down

0 comments on commit 9b6d9a2

Please sign in to comment.