Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
carousel.setActiveCarouselItemIndex(index) not working in OnsenUI 2.0 with Angular 1
kkng_88 last edited by Fran Diox
I’ve spent a few days trying to figure out what is wrong via documentation - this should work easily out of the box but seems that something more fundamental is causing the issue…
How to recreate the issue
- Created a new project from the templates on Monaca - Onsen UI 2.0 with Angular 1.
- Loaded the OnsenUI 2.0 theme and Monaca JQuery latest version from CSS/JS components
- Created a carousel and a button to change the carousel index
- Carousel does not change when button is clicked.
- When button is clicked, console log shows that setActiveCarouselItemIndex is not a function
- However, carousel.next() works fine
Here’s my code:
<ons-page> <ons-button ng-click="carousel.setActiveCarouselItemIndex(2)">Push Carousel</ons-button> <ons-carousel style="height:100%;width:100%;" var="carousel" swipeable overscrollable auto-scroll> <ons-carousel-item>Page 1 </ons-carousel-item> <ons-carousel-item>Page 2 </ons-carousel-item> <ons-carousel-item>Page 3</ons-carousel-item> </ons-carousel> </ons-page>
Did you find a place in the docs where it’s not updated?
kkng_88 last edited by
Thanks Fran, that certainly did work…
However, the documentation does not seem to be updated in anyway to reflect that.
@kkng_88 In my last post I put a link to the docs and it’s updated there. I don’t know where did you find the wrong information. Are you perhaps checking v1 docs?