diff options
| author | Matias Niemelä | 2013-06-18 13:59:57 -0400 | 
|---|---|---|
| committer | Misko Hevery | 2013-07-26 23:49:54 -0700 | 
| commit | 81923f1e41560327f7de6e8fddfda0d2612658f3 (patch) | |
| tree | bbf8151bddf4d026f8f5fa3196b84a45ecd9c858 /src/ngRoute/directive/ngView.js | |
| parent | 11521a4cde689c2bd6aaa227b1f45cb3fb53725b (diff) | |
| download | angular.js-81923f1e41560327f7de6e8fddfda0d2612658f3.tar.bz2 | |
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
Diffstat (limited to 'src/ngRoute/directive/ngView.js')
| -rw-r--r-- | src/ngRoute/directive/ngView.js | 22 | 
1 files changed, 9 insertions, 13 deletions
| 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);            <div              ng-view -            class="example-animate-container" -            ng-animate="{enter: 'example-enter', leave: 'example-leave'}"></div> +            class="example-$animate-container" +            ng-$animate="{enter: 'example-enter', leave: 'example-leave'}"></div>            <hr />            <pre>$location.path() = {{main.$location.path()}}</pre> @@ -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('<div></div>').html(template).contents(); -          animate.enter(enterElements, element); +          $animate.enter(enterElements, element);            var link = $compile(enterElements),                current = $route.current, | 
