aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatias Niemelä2013-07-23 23:02:15 -0400
committerMisko Hevery2013-07-26 23:49:54 -0700
commit8ed0d5b6aa2e29ebc8d2026cb04380ed3343baef (patch)
tree2c14004d495badc36f6336a322160e9ec2c3cf5b /src
parent81923f1e41560327f7de6e8fddfda0d2612658f3 (diff)
downloadangular.js-8ed0d5b6aa2e29ebc8d2026cb04380ed3343baef.tar.bz2
chore($animate): replace show/hide with addClass/removeClass
Diffstat (limited to 'src')
-rw-r--r--src/ng/animate.js10
-rw-r--r--src/ng/directive/ngShowHide.js4
-rw-r--r--src/ngAnimate/animate.js62
3 files changed, 3 insertions, 73 deletions
diff --git a/src/ng/animate.js b/src/ng/animate.js
index 7e515594..206a4b03 100644
--- a/src/ng/animate.js
+++ b/src/ng/animate.js
@@ -80,16 +80,6 @@ var $AnimateProvider = ['$provide', function($provide) {
this.enter(element, parent, after, done);
},
- show : function(element, done) {
- element.removeClass('ng-hide');
- (done || noop)();
- },
-
- hide : function(element, done) {
- element.addClass('ng-hide');
- (done || noop)();
- },
-
addClass : function(element, className, done) {
className = isString(className) ?
className :
diff --git a/src/ng/directive/ngShowHide.js b/src/ng/directive/ngShowHide.js
index bdbcf463..1bba11ef 100644
--- a/src/ng/directive/ngShowHide.js
+++ b/src/ng/directive/ngShowHide.js
@@ -100,7 +100,7 @@
var ngShowDirective = ['$animate', function($animate) {
return function(scope, element, attr) {
scope.$watch(attr.ngShow, function ngShowWatchAction(value){
- $animate[toBoolean(value) ? 'show' : 'hide'](element);
+ $animate[toBoolean(value) ? 'removeClass' : 'addClass'](element, 'ng-hide');
});
};
}];
@@ -204,7 +204,7 @@ var ngShowDirective = ['$animate', function($animate) {
var ngHideDirective = ['$animate', function($animate) {
return function(scope, element, attr) {
scope.$watch(attr.ngHide, function ngHideWatchAction(value){
- $animate[toBoolean(value) ? 'hide' : 'show'](element);
+ $animate[toBoolean(value) ? 'addClass' : 'removeClass'](element, 'ng-hide');
});
};
}];
diff --git a/src/ngAnimate/animate.js b/src/ngAnimate/animate.js
index ab7a19b0..93ff9d8c 100644
--- a/src/ngAnimate/animate.js
+++ b/src/ngAnimate/animate.js
@@ -30,8 +30,8 @@
* | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave |
* | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave |
* | {@link ng.directive:ngIf#animations ngIf} | enter and leave |
- * | {@link ng.directive:ngShow#animations ngShow & ngHide} | show and hide |
* | {@link ng.directive:ngShow#animations ngClass} | add and remove |
+ * | {@link ng.directive:ngShow#animations ngShow & ngHide} | add and remove (the ng-hide class value) |
*
* You can find out more information about animations upon visiting each directive page.
*
@@ -337,60 +337,6 @@ angular.module('ngAnimate', ['ng'])
/**
* @ngdoc function
- * @name ngAnimate.$animate#show
- * @methodOf ngAnimate.$animate
- * @function
- *
- * @description
- * Reveals the element by removing the `ng-hide` class thus performing an animation in the process. During
- * this animation the CSS classes present on the element will be:
- *
- * <pre>
- * .ng-hide //already on the element if hidden
- * .ng-hide-remove
- * .ng-hide-remove-active
- * </pre>
- *
- * Once the animation is complete then all three CSS classes will be removed from the element.
- * The done callback, if provided, will be also fired once the animation is complete.
- *
- * @param {jQuery/jqLite element} element the element that will be rendered visible or hidden
- * @param {function()=} done callback function that will be called once the animation is complete
- */
- show : function(element, done) {
- performAnimation('show', 'ng-hide-remove', element, null, null, function() {
- $delegate.show(element, done);
- });
- },
-
- /**
- * @ngdoc function
- * @name ngAnimate.$animate#hide
- * @methodOf ngAnimate.$animate
- *
- * @description
- * Sets the element to hidden by adding the `ng-hide` class it. However, before the class is applied
- * the following CSS classes will be added temporarily to trigger any animation code:
- *
- * <pre>
- * .ng-hide-add
- * .ng-hide-add-active
- * </pre>
- *
- * Once the animation is complete then both CSS classes will be removed and `ng-hide` will be added to the element.
- * The done callback, if provided, will be also fired once the animation is complete.
- *
- * @param {jQuery/jqLite element} element the element that will be rendered visible or hidden
- * @param {function()=} done callback function that will be called once the animation is complete
- */
- hide : function(element, done) {
- performAnimation('hide', 'ng-hide-add', element, null, null, function() {
- $delegate.hide(element, done);
- });
- },
-
- /**
- * @ngdoc function
* @name ngAnimate.$animate#addClass
* @methodOf ngAnimate.$animate
*
@@ -617,12 +563,6 @@ angular.module('ngAnimate', ['ng'])
move : function(element, done) {
return animate(element, 'ng-move', done);
},
- show : function(element, done) {
- return animate(element, 'ng-hide-remove', done);
- },
- hide : function(element, done) {
- return animate(element, 'ng-hide-add', done);
- },
addClass : function(element, className, done) {
return animate(element, className, done);
},