Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Carousel strange transition [bootstrap 3] #1350

Closed
djordje opened this issue Dec 4, 2013 · 42 comments
Closed

Carousel strange transition [bootstrap 3] #1350

djordje opened this issue Dec 4, 2013 · 42 comments

Comments

@djordje
Copy link

djordje commented Dec 4, 2013

I've made video that show behaviour (angular 1.2.3).

https://dl.dropboxusercontent.com/u/21598387/AngularUI_Bootstrap3_carousel.mov

@pkozlowski-opensource
Copy link
Member

@djordje what is the version of this library that you are using? Please note that BS3 support is only available in the development branch (bootstrap3).

@djordje
Copy link
Author

djordje commented Dec 5, 2013

Latest bootstrap3 branch - d7c69d4

@sudhakar
Copy link

sudhakar commented Dec 9, 2013

Yep. I can confirm this behaviour. It happens only when ngAnimate module is loaded. Tested with angular 1.2.3 & bootstrap3 d7c69d4.

@AttilaSATAN
Copy link

I can confirm that its about ngAnimate. (bs3, angular 1.2.0)

@djordje
Copy link
Author

djordje commented Dec 11, 2013

I found work around: http://plnkr.co/edit/8HfZCaTOIeAesKVFSFpj?p=preview

@AttilaSATAN
Copy link

@djordje ty very much it realy saves so much of my time.

@simonykq
Copy link

First to create a directive as following :

app.directive('disableAnimation', function($animate){
    return {
        restrict: 'A',
        link: function($scope, $element, $attrs){
            $attrs.$observe('disableAnimation', function(value){
                $animate.enabled(!value, $element);
            });
        }
    }
});

Given that your app have already declared 'ngAnimate' as dependency. Then, create the following HTML code, and it should work

<carousel interval="5000" disable-animation="true">
  <slide ng-repeat="slide in slides">
    <img ng-src="{{slide.image}}" width="1000" height="300" style="margin:auto;">
  </slide>
</carousel>

@djordje

@pkozlowski-opensource
Copy link
Member

Hmm, seems like this is still a problem with the latest release of AngularJS:
http://plnkr.co/edit/Xl5Ok6UOJFAuZyTxO39F?p=preview

@chrisirhc chrisirhc self-assigned this Feb 19, 2014
@eliranmal
Copy link

@djordje - great workaround, thanks a lot.

@sandersietses
Copy link

Workaround works, thanks.

But could you please fix this? It still exists in AngularJS 1.2.14.

I've modified your example code:
http://plnkr.co/edit/PKiOP8D4vPnVy8wNOidO

Thank you!

@Foxandxss
Copy link
Contributor

@Aldentev That is going to be fixed on the next version.

@jkimvital
Copy link

This still happens in 1.2.16

@leniel
Copy link

leniel commented May 20, 2014

Yep... still happening in 1.2.16. 😟

Thanks @simonykq... your workaround is nice.

@iamlothian
Copy link

duplicate issue #1273

@whitehat101
Copy link

@simonykq 👍

I refactored simonykq's solution, because I just wanted to disable ng-animate (never explicitly enable it) to get <carousel> to work. I also made the code minification safe and "optimized" the link function by dropping the unused $attrs parameter.

CoffeeScript:

app.directive 'disableNgAnimate', ['$animate', ($animate)->
  restrict: 'A'
  link: (scope, element)-> $animate.enabled false, element
]

JavaScript:

app.directive('disableNgAnimate', ['$animate', function($animate) {
  return {
    restrict: 'A',
    link: function(scope, element) {
      $animate.enabled(false, element);
    }
  };
}]);

Use:

<carousel disable-ng-animate>
  ...
</carousel>

@goodbomb
Copy link

I'm currently using Angular-Bootstrap v0.11.0 and Angular.js v1.2.19. I've tried disabling ngAnimate entirely and the workaround Directive that selectively disables ngAnimate, but I can't get the carousel to work. The slide classes don't update when they try to transition, so slide 1 has the following classes: item text-center ng-isolate-scope active left and slide 2 has item text-center ng-isolate-scope next left and it remains stuck there. Nothing changes. The prev() and next() buttons also do nothing.

@bang-dc
Copy link

bang-dc commented Jul 17, 2014

@simonykq thank you!

@simonykq
Copy link

@whitehat101. Yes yours is better. Many thanks

@skusunam
Copy link

@simonykq @whitehat101 Thanks for the solution.

@davsantos
Copy link

@simonykq @whitehat101 Thanks your solution works simple and neat. I am a newbie and I don't understand what this is really doing inside the carousel and outside it. Could you give me a quick explanation? If this is not really the place to ask then please forgive me and ignore.

@raulgomis
Copy link

Thanks for the solution. but is there any update on this? will be fixed soon?

@chrisirhc chrisirhc modified the milestones: 0.13, 0.12 Nov 16, 2014
@jirihelmich
Copy link

Thanks for the workaround! This is such an annoying bug feature, very hard to find.

@JobaDiniz
Copy link

Hi, it doesn't work if I have a ng-show:

<carousel ng-show="promos.length > 1" disable-ng-animate>
        <slide ng-repeat="promo in promos">
            <img ng-if="!promo.containsUrl()" ng-src="{{promo.image}}" alt="{{promo.title}}" />
            <a ng-if="promo.containsUrl()" ng-href="{{promo.url}}" ng-click="bannerClick(promo.pid)"><img ng-src="{{promo.image}}" alt="{{promo.title}}" /></a>
        </slide>
    </carousel>

If I remove ng-show, the workaround works...
Any ideas to fix my scenario?

@iamlothian
Copy link

Wrap it in an outer div. That has the ng-show on it.
On 23/12/2014 10:56 pm, "Joberto Diniz" [email protected] wrote:

Hi, it doesn't work if I have a `ng-show´:

{{promo.title}} {{promo.title}}

If I remove ng-show, the workaround works...
Any ideas to fix my scenario?


Reply to this email directly or view it on GitHub
#1350 (comment)
.

@JobaDiniz
Copy link

Yeah.. this works. Thanks.

@simonykq
Copy link

I think the problem may come from the priority option in $compile service. ngShow use the default one which is 0.

Try set the priority option in disable-ng-animate directive to something which is either greater or below 0 and see if this would fix the problem

@fnagel
Copy link

fnagel commented Jan 9, 2015

Thanks @simonykq for the workaround!

This really needs to be fixed.

@dmarcelino
Copy link

Thank you @simonykq, that fixed the issue I was experiencing.

BTW, I'm using:

  • angularUI#0.12.0
  • angular#1.3.8
  • angular-animate#1.3.8

@timtim-75
Copy link

Hi there,

I'm using Angular 1.3.2, Bootstrap 3.x.

On safari, the workaround doesn't fix the issue.

The carousel is loaded, I can only click once on next/prev, then nothing else happen. Something strange, the next/prev slide is shown, but the first is still on the page.

Here is my first slide, before I click next, on the left, 99 is the ID of this picture.

2

And here is the second slide, after I click next, on the left, you can see the ID of this picture, but still the ID of the previous one.

3

Here is the directive

.directive('disableNgAnimate', ['$animate',
    function ($animate) {
        return {
            restrict: 'A',
            link: function (scope, element) {
                $animate.enabled(false, element);
            }
        };
}]);

Any idea ?

Thanks a lot

@rubenjimenez
Copy link

I think I'm suffering the same issue. In my case, when i press next or prev arrows sometimes I got the slide to change once, sometimes it doesn't event change. Same behavior in Chrome/Safari. It started to happen when I added ngAnimate to the project.

@bentleyo
Copy link

bentleyo commented Mar 5, 2015

Can we add a note about this ngAnimate + ui.bootstrap incompatibility to the FAQ?
I just ran into this issue and it was a real pain to figure out. I ended up going with the fix @simonykq provided (thanks Simon!).

@markleusink
Copy link

@bentleyo Know that feeling. Just went through the same tough process :(

+1 for adding a line to the docs and mentioning the workaround (disabling ng-animate completely or only for the directive).

@altazar
Copy link

altazar commented Mar 8, 2015

I have a similar, but different problem. When slides scroll top part of pictures disappears. This happens only in (latest) Firefox. http://kulturfokus.eu/en/projekte/aufsteinernenspuren

chrisirhc added a commit to chrisirhc/angular-ui-bootstrap that referenced this issue Mar 16, 2015
chrisirhc added a commit to chrisirhc/angular-ui-bootstrap that referenced this issue Mar 17, 2015
@ivan-abrash
Copy link

@simonykq thanks!

@gustavobigardi
Copy link

@simonykq thanks!!! I lost almost a day trying to resolve this!

@daveteply
Copy link

This can also be remedied by specifying a specific prefix when configuring your app.

angular.module('fooMod',['ngAnimate']).config(function($animateProvider) {
    $animateProvider.classNameFilter(/prefix-/);
...

We had an issue with the carousel after adding another library that required ngAnimate. This library uses CSS classes that begin with anim- so we configured our animate provider with that:

    $animateProvider.classNameFilter(/anim-/);

This tells ngAnimate to only animate classes that begin with anim-.

See https://docs.angularjs.org/api/ngAnimate 'Preventing Collisions With Third Party Libraries' for more details.

@char0n
Copy link

char0n commented May 21, 2015

The work around doesn't seem to work when you are displaying carousel in $modal.
My animate provider is configured like so:

$animateProvider.classNameFilter(/(app-repeated-item)|(modal)/);
// The modal inside the definition fixes #3647

When I remove the class name filter, arrws on carousel seems to work fine.

@simonykq solutions doesn't seem to work in this scenario. It seems absurd that ui-bootstrap which is pure angular implementation of bootstrap components, doesn't work with core angular modules.

I fall-backed using native bootstrap components that works out of the box.

@Avcajaraville
Copy link

@simonykq Thanks man, save my day :)

@edrpls
Copy link

edrpls commented Jul 1, 2015

Hi, I've used the disableNgAnimate but in my case the carousel directive is only toggling the 'active' class, not adding/removing the others used for animation, this means the slides only toggle but do not animate.

I'm using "angular": "^1.3.0" with "angular-bootstrap": "~0.13.0".

Any ideas how to fix this?

EDIT: Nevermind, I found that I was using 1.4 and it's still not supported by angular-ui. Rolled back to 1.3.16 and everything is working again.

@MastroPino
Copy link

@simonykq
thanks, it worked!

@sauminkirve
Copy link

@simonykq,

Thanks a lot man... great job. it works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.