-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Refactor carousel to work with ngAnimate #2699
Refactor carousel to work with ngAnimate #2699
Conversation
72a97a0
to
c39d1ab
Compare
c39d1ab
to
3985500
Compare
edcb62a
to
1843e4b
Compare
@pkozlowski-opensource The one thing I'm not so sure about is where to place the css files. I'm keeping them in the |
I needed ngAnimate to cooperate with the carousel implementation in angular-bootstrap, so I went ahead and merged this branch into my local tree and it worked flawlessly. I've even reviewed the code (while trying to understand how carousel works and what was changed), and I liked what I saw, even though my JS knowledge is limited. Is there an ETA when this code can be merged? It'd be lovely to see a new release so I don't have to keep a patched copy. Thanks |
@bazsi I'm guess I'm bottleneck here.... |
Sounds good to me. Drop me a message when you're available after ngEurope. Meanwhile I'll try to figure out if AngularJS 1.3's animation updates will affect this and whether it can be any more elegant. |
This fails now in 1.3 as $ngAnimate functionality return promises. So just need to change: $animate.addClass(slide, directionDirClass, function() {
slide.removeClass(directionDirClass + ' ' + direction);
animationDone();
}); to $animate.addClass(slide, directionDirClass).then(function() {
slide.removeClass(directionDirClass + ' ' + direction);
animationDone();
}); I did do this locally and would have done PR but seems i'm using a really old version of this locally. |
@chrisirhc how is this coming. I am using your branch rather then bower since this component is so broken in the current release its basically unusable imo |
@intellix Thanks for posting that, I was wondering wth was going on :) I wish this stuff would get merged in. |
This fixed the numerous issues I was having with Carousel on IOS. Thanks! |
@chrisirhc - This can't be automerged at present... |
@chrisirhc I think you should merge it to put an end to it. It is still up to date ? |
before it is merged @intellix comment is applicable and should be added as well. |
I'll rebase it in a bit. |
1843e4b
to
044719b
Compare
Rebased and now it works well with the custom builds. Note that there's something up with using Angular 1.3 on the demo site. The Custom Builds doesn't seem to work. However, that's a separate issue. |
@chrisirhc did you happen to see my comment about noting @intellix post regarding 1.3 incompatibility? Its a few posts up, but I'll quote it here for posterity (not sure if its related to what you are seeing on the demo site):
|
}(nextSlide, self.currentSlide)); | ||
} else { | ||
transitionDone(nextSlide, self.currentSlide); | ||
if ($animate.enabled() && !$scope.noTransition && nextSlide.$element) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only question I have about this check is that there is the potential for nextSlide.$element.data('$$ngAnimateState').disabled
to be true - in that case, this would be broken. Do we want to say that we do not support this use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think if I do this on the $animate:before
event for any slide element (and attach it in the slide directive)?
Since it should only mark $currentTransition = true
when the animation has started, and it'll only close if it starts. There's a possible race condition where an animation hasn't started but has been queued, but may not matter so much I think, as it's only meant to prevent double-clicking causing a weird transition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I was just looking at the animation code (in https://github.com/angular/angular.js/blob/g3_v1_2/src/ngAnimate/animate.js#L856-L861), I think the close event always even if the animation is disabled for the element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you're right - ignore my comment.
@wgorder , Thanks for the heads up! I just saw that. I'll fix that for Angular 1.3 since we're going for Angular 1.3 compatibility in the next release. |
Fixes angular-ui#1350 Fixes angular-ui#1513 Fixes angular-ui#1185 Fixes angular-ui#2062 Fixes angular-ui#2235 Closes angular-ui#2067
044719b
to
5af6224
Compare
Fixed compatibility with Angular 1.3 |
What I would need to do in ui.bootstrap-tpl.js file for these changes to take effect? |
This PR LGTM. |
Merged via 431b9c7 . Thanks! |
This is a much cleaner solution that makes use of ngAnimate as it was intended.
It requires a few lines of CSS that will be added by default (similar to how AngularJS adds CSS for ng-hide).
I'll add a Grunt task that will provide the CSS in a separate file so that users that have CSP can add the CSS files separately.
Supercedes #1878.
Fixes #1350 #1513 #1185 #2062 #2235.
Things left: