mihnsen / ui-carousel

A simple, lightweight module for carousel in your AngularJS app, Inspired from slick carousel.
http://mihnsen.github.io/ui-carousel/
MIT License
77 stars 67 forks source link

Using ng-if causes duplicates in the number of items #5

Open zeiadhabbab opened 7 years ago

zeiadhabbab commented 7 years ago

When adding ng-if on container div for ui-carousel, each time the div is displayed , ui-carousel will multiply the items inside of it.

this is the example of the code:

<div  ng-if="Dashboard.flag">
    <ui-carousel
        slides="Dashboard.slides"
        slides-to-show="3"
        slides-to-scroll="1"
        initial-slide="1"
        dots="true">
      <carousel-item>
        <h3>{{ item + 1 }}</h3>
      </carousel-item>
    </ui-carousel>
  </div>
  <button ng-click="Dashboard.showhide()">Click me</button>

any idea how to fix this?

this is the firs time: wpch4uhz1xlvwaaaabjru5erkjggg

this is after hiding and showing div: dxacl8nr52wbaaaaaelftksuqmcc

mihnsen commented 7 years ago

@zeiadhabbab Fixed on e3696ca