This repository has been archived by the owner on Feb 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(animate): ng-animate and ng-animate-children.
These two directives allow you to control animations and turn them on or off on individual elements or whole sections of dom. Closes #661
- Loading branch information
Showing
6 changed files
with
333 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
part of angular.animate; | ||
|
||
/** | ||
* This provides DOM controls for turning animations on and off for individual | ||
* dom elements. Valid options are [always] [never] and [auto]. If this | ||
* directive is not applied the default value is [auto] for animation. | ||
*/ | ||
@NgDirective(selector: '[ng-animate]', | ||
map: const {'ng-animate': '@option'}) | ||
class NgAnimateDirective extends NgAnimateDirectiveBase { | ||
set option(value) { | ||
_option = value; | ||
_optimizer.alwaysAnimate(_element, _option); | ||
} | ||
|
||
NgAnimateDirective(dom.Element element, AnimationOptimizer optimizer) | ||
: super(element, optimizer); | ||
} | ||
|
||
/** | ||
* This provides DOM controls for turning animations on and off for child | ||
* dom elements. Valid options are [always] [never] and [auto]. If this | ||
* directive is not applied the default value is [auto] for animation. | ||
* | ||
* Values provided in [ng-animate] will override this directive since they are | ||
* more specific. | ||
*/ | ||
@NgDirective(selector: '[ng-animate-children]', | ||
map: const {'ng-animate-children': '@option'}) | ||
class NgAnimateChildrenDirective extends NgAnimateDirectiveBase { | ||
set option(value) { | ||
_option = value; | ||
_optimizer.alwaysAnimateChildren(_element, _option); | ||
} | ||
|
||
NgAnimateChildrenDirective(dom.Element element, AnimationOptimizer optimizer) | ||
: super(element, optimizer); | ||
} | ||
|
||
/** | ||
* Base class for directives that control animations with an | ||
* [AnimationOptimizer]. | ||
*/ | ||
abstract class NgAnimateDirectiveBase implements NgDetachAware { | ||
final AnimationOptimizer _optimizer; | ||
final dom.Element _element; | ||
|
||
String _option = "auto"; | ||
String get option => _option; | ||
set option(value); | ||
|
||
NgAnimateDirectiveBase(this._element, this._optimizer); | ||
|
||
detach() { | ||
_optimizer.detachAlwaysAnimateOptions(_element); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.