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

Commit 0cb04e2

Browse files
matskomhevery
authored andcommitted
chore(ngIf): Add animation code to ngIf example and docs text to ngAnimate docs
1 parent 404c9a6 commit 0cb04e2

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

src/ng/animator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* | {@link ng.directive:ngView#animations ngView} | enter and leave |
2222
* | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave |
2323
* | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave |
24+
* | {@link ng.directive:ngIf#animations ngIf} | enter and leave |
2425
* | {@link ng.directive:ngShow#animations ngShow & ngHide} | show and hide |
2526
*
2627
* You can find out more information about animations upon visiting each directive page.

src/ng/directive/ngIf.js

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,38 @@
4343
* the element is removed from the DOM tree (HTML).
4444
*
4545
* @example
46-
<doc:example>
47-
<doc:source>
48-
Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /><br/>
49-
Show when checked: <span ng-if="checked">I'm removed when the checkbox is unchecked</span>
50-
</doc:source>
51-
</doc:example>
46+
<example animations="true">
47+
<file name="index.html">
48+
Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /><br/>
49+
Show when checked:
50+
<span ng-if="checked" ng-animate="'example'">
51+
I'm removed when the checkbox is unchecked.
52+
</span>
53+
</file>
54+
<file name="animations.css">
55+
.example-leave-setup, .example-enter-setup {
56+
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
57+
-moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
58+
-ms-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
59+
-o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
60+
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
61+
}
62+
63+
.example-enter-setup {
64+
opacity:0;
65+
}
66+
.example-enter-setup.example-enter-start {
67+
opacity:1;
68+
}
69+
70+
.example-leave-setup {
71+
opacity:1;
72+
}
73+
.example-leave-setup.example-leave-start {
74+
opacity:0;
75+
}
76+
</file>
77+
</example>
5278
*/
5379
var ngIfDirective = ['$animator', function($animator) {
5480
return {

0 commit comments

Comments
 (0)