From 81923f1e41560327f7de6e8fddfda0d2612658f3 Mon Sep 17 00:00:00 2001 From: Matias Niemelä Date: Tue, 18 Jun 2013 13:59:57 -0400 Subject: feat(ngAnimate): complete rewrite of animations - ngAnimate directive is gone and was replaced with class based animations/transitions - support for triggering animations on css class additions and removals - done callback was added to all animation apis - $animation and $animator where merged into a single $animate service with api: - $animate.enter(element, parent, after, done); - $animate.leave(element, done); - $animate.move(element, parent, after, done); - $animate.addClass(element, className, done); - $animate.removeClass(element, className, done); BREAKING CHANGE: too many things changed, we'll write up a separate doc with migration instructions --- src/ngRoute/directive/ngView.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/ngRoute/directive') diff --git a/src/ngRoute/directive/ngView.js b/src/ngRoute/directive/ngView.js index 935ba05d..3074df49 100644 --- a/src/ngRoute/directive/ngView.js +++ b/src/ngRoute/directive/ngView.js @@ -14,9 +14,6 @@ ngRouteModule.directive('ngView', ngViewFactory); * Every time the current route changes, the included view changes with it according to the * configuration of the `$route` service. * - * Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter** - * and **leave** effects. - * * @animations * enter - happens just after the ngView contents are changed (when the new view DOM element is inserted into the DOM) * leave - happens just after the current ngView contents change and just before the former contents are removed from the DOM @@ -35,8 +32,8 @@ ngRouteModule.directive('ngView', ngViewFactory);
+ class="example-$animate-container" + ng-$animate="{enter: 'example-enter', leave: 'example-leave'}">
$location.path() = {{main.$location.path()}}
@@ -71,12 +68,12 @@ ngRouteModule.directive('ngView', ngViewFactory); transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; } - .example-animate-container { + .example-$animate-container { position:relative; height:100px; } - .example-animate-container > * { + .example-$animate-container > * { display:block; width:100%; border-left:1px solid black; @@ -162,15 +159,14 @@ ngRouteModule.directive('ngView', ngViewFactory); * @description * Emitted every time the ngView content is reloaded. */ -ngViewFactory.$inject = ['$route', '$anchorScroll', '$compile', '$controller', '$animator']; -function ngViewFactory( $route, $anchorScroll, $compile, $controller, $animator) { +ngViewFactory.$inject = ['$route', '$anchorScroll', '$compile', '$controller', '$animate']; +function ngViewFactory( $route, $anchorScroll, $compile, $controller, $animate) { return { restrict: 'ECA', terminal: true, link: function(scope, element, attr) { var lastScope, - onloadExp = attr.onload || '', - animate = $animator(scope, attr); + onloadExp = attr.onload || ''; scope.$on('$routeChangeSuccess', update); update(); @@ -184,7 +180,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller, } function clearContent() { - animate.leave(element.contents(), element); + $animate.leave(element.contents()); destroyLastScope(); } @@ -195,7 +191,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller, if (template) { clearContent(); var enterElements = jqLite('
').html(template).contents(); - animate.enter(enterElements, element); + $animate.enter(enterElements, element); var link = $compile(enterElements), current = $route.current, -- cgit v1.2.3