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

How use ng-repeat into carousel-item before item rendered #37

Open ivanferrer opened 6 years ago

ivanferrer commented 6 years ago
<ui-carousel
    slides="steps"
    slides-to-show="1"
    slides-to-scroll="1"
    autoplay="false"
    autoplay-speed="2000"
    on-after-change="singleAfterWelcome(currentSlide)"
    dots="false">
        <carousel-item>
           <div ng-show="item.step == '0'">
               <!-- step 0 -->
           </div>
           <div ng-show="item.step == '1'">
               <!-- step 1 -->
               <div class="col-xs-12 col-md-12 text-center ola-text">
                   <div class="gallery-categories">
                       <!-- //******* this is displayed but not showing in ng-repeat ******* -->
                       {{ item.collection_category}}
                      <!-- //******* this is not reading ngRepeat ******* -->
                      <div ng-repeat="category in item.collection_category">
                          <i class="{{category.icon}}" ng-class="{'active':category.active == true}"></i>
                          <a href="javascript:void(0)" ng-click="category.action()"><span>{{category.title}}</span></a>
                     </div>
                 </div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </carousel-item>
</ui-carousel>

Ng-repeat is not working this way into <carousel-item> tag:

 <div ng-repeat="i in [1, 2, 3, 4, 5]">
    <span>{{i}}</span>
</div>
Assdi commented 6 years ago

got the same issue :(

illuska812 commented 6 years ago

+1

Assdi commented 6 years ago

pre processing is solution i think

stoque commented 6 years ago

+1

stoque commented 6 years ago

@Assdi how can i do this?

Assdi commented 6 years ago

pre-processing in controller I did e.g if u want to do this <div ng-repeat="i in [1, 2, 3, 4, 5]"> <span>{{i}}</span> </div>

then make a string of this in controller like this var str=''; array=[1,2,3,4]; array.foreach(function(ele){ str+=' '+ele; }); And this push this str into slides object which is step in above case @stoque

ghost commented 6 years ago

+1