Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 3d158f6

Browse files
committed
docs(ngAnimateChildren) add docs
1 parent 8aecf46 commit 3d158f6

File tree

2 files changed

+80
-2
lines changed

2 files changed

+80
-2
lines changed

src/ngAnimate/animateChildrenDirective.js

+79-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,83 @@
11
'use strict';
22

3+
/**
4+
* @ngdoc directive
5+
* @name ngAnimateChildren
6+
* @restrict AE
7+
* @element ANY
8+
*
9+
* @description
10+
*
11+
* ngAnimateChildren allows you to specify that children of this element should animate even if any
12+
* of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move`
13+
* (structural) animation, child elements that also have an active structural animation are not animated.
14+
*
15+
* Note that even if `ngAnimteChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation).
16+
*
17+
*
18+
* @param {string} ngAnimateChildren If the value is empty, `true` or `on`,
19+
* then child animations are allowed. If the value is `false`, child animations are not allowed.
20+
*
21+
* @example
22+
* <example module="ngAnimateChildren" name="ngAnimateChildren" deps="angular-animate.js" animations="true">
23+
<file name="index.html">
24+
<div ng-controller="mainController as main">
25+
<label>Show container? <input type="checkbox" ng-model="main.enterElement" /></label>
26+
<label>Animate children? <input type="checkbox" ng-model="main.animateChildren" /></label>
27+
<hr>
28+
<div ng-animate-children="{{main.animateChildren}}">
29+
<div ng-if="main.enterElement" class="container">
30+
List of items:
31+
<div ng-repeat="item in [0, 1, 2, 3]" class="item">Item {{item}}</div>
32+
</div>
33+
</div>
34+
</div>
35+
</file>
36+
<file name="animations.css">
37+
38+
.container.ng-enter,
39+
.container.ng-leave {
40+
transition: all ease 1.5s;
41+
}
42+
43+
.container.ng-enter,
44+
.container.ng-leave-active {
45+
opacity: 0;
46+
}
47+
48+
.container.ng-leave,
49+
.container.ng-enter-active {
50+
opacity: 1;
51+
}
52+
53+
.item {
54+
background: firebrick;
55+
color: #FFF;
56+
margin-bottom: 10px;
57+
}
58+
59+
.item.ng-enter,
60+
.item.ng-leave {
61+
transition: transform 1.5s ease;
62+
}
63+
64+
.item.ng-enter {
65+
transform: translateX(50px);
66+
}
67+
68+
.item.ng-enter-active {
69+
transform: translateX(0);
70+
}
71+
</file>
72+
<file name="script.js">
73+
angular.module('ngAnimateChildren', ['ngAnimate'])
74+
.controller('mainController', function() {
75+
this.animateChildren = false;
76+
this.enterElement = false;
77+
});
78+
</file>
79+
</example>
80+
*/
381
var $$AnimateChildrenDirective = ['$interpolate', function($interpolate) {
482
return {
583
link: function(scope, element, attrs) {
@@ -9,7 +87,7 @@ var $$AnimateChildrenDirective = ['$interpolate', function($interpolate) {
987
} else {
1088
// Interpolate and set the value, so that it is available to
1189
// animations that run right after compilation
12-
setData($interpolate(attrs.ngAnimateChildren)(scope));
90+
setData($interpolate(val)(scope));
1391
attrs.$observe('ngAnimateChildren', setData);
1492
}
1593

test/ngAnimate/animateSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,7 @@ describe("animations", function() {
14941494
}));
14951495

14961496
it('should respect the value if the directive is on an element with ngIf',
1497-
inject(function($animate, $rootScope, $rootElement, $compile) {
1497+
inject(function($rootScope, $rootElement, $compile) {
14981498

14991499
parent.attr('ng-animate-children', 'true');
15001500
parent.attr('ng-if', 'true');

0 commit comments

Comments
 (0)