2

I am using angular-carousel to display set of images in a carousel. The carousel is working fine except the indicator.The indicator are not getting displayed. Following is the code for carouse.

  <ul rn-carousel rn-carousel-pause-on-hover="" rn-carousel-auto-slide="" class="image" ng-init="images = ['assets/img/1.png','assets/img/2.png','assets/img/3.png']">
    <li ng-repeat="image in images"><img src="{{image}}"/></li>
  </ul>

The following is the div to display the indicator.

<div rn-carousel-indicators ng-if="images.length > 1" slides="images" rn-carousel-index="carouselIndex"></div>

Can anybody suggest how to get the indicator working. enter image description here

Ajeet Khan
  • 8,582
  • 8
  • 42
  • 65

1 Answers1

1

You need to bind carouselIndex to the carousel directive:

<ul rn-carousel rn-carousel-pause-on-hover="" rn-carousel-auto-slide="" rn-carousel-index="carouselIndex" class="image" ng-init="images = ['assets/img/1.png','assets/img/2.png','assets/img/3.png']">
Alon Eitan
  • 11,997
  • 8
  • 49
  • 58
  • indicator are not even visible – Ajeet Khan Jan 16 '16 at 17:49
  • From the documentation: _Note: If loading in slides from an async service, the ng-if="slides.length > 1" may not update as expected. In this case, try ng-if="slides"._ - So if that's the case, try change to indicator directive's `nfIf` to `ng-if="images"` – Alon Eitan Jan 16 '16 at 17:50
  • see the console output after updating to `ng-if="images"` and keeping `ng-if="images.lenght>1"` – Ajeet Khan Jan 16 '16 at 17:59
  • Try setting the images inside the controller, I'm not sure why it's not working, so i'll remove this answer – Alon Eitan Jan 16 '16 at 18:05
  • The `images` were not in the scope of indicator `
    `. I moved the `images` initialization on the parent of `
      `. Now the indicator are displayed but not working as per sliding or on click.
    – Ajeet Khan Jan 16 '16 at 18:23
  • Try changing (both in the carousel directive and indicators directives) `carouselIndex` to `carousel.carouselIndex` (Make the index an object - It might help) – Alon Eitan Jan 16 '16 at 18:27
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/100855/discussion-between-ajeet-khan-and-alon). – Ajeet Khan Jan 16 '16 at 18:35