I am trying to control the carousel through buttons, not the controls above the carousel (I will hide the chevron badges).
I inspected the chevron badge and found this in the source:
<a role="button" href="" class="left carousel-control" ng-click="prev()" ng-class="{ disabled: isPrevDisabled() }" ng-show="slides.length > 1"> <span aria-hidden="true" class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">previous</span> </a>
I tried adding attributes to the button (except for the class), but this did not work:
<button type="button" class="btn btn-default btn-block" ng-click="prev()" ng-class="{ disabled: isPrevDisabled() }" ng-show="slides.length > 1">Previous</button>
- I assume this does not work because the button is not within the uib-carousel, so it does not know what the 'prev ()' and 'isPrevDisabled ()' functions are. Can I reference this function or create my own controls?
Demo Plnkr
Another thing that I noticed, but it is off topic, is if you double-click the right or left chevron button (let them say right), it goes only one slide to the right. And then, if I click on the left chevron, it will move to the right once, and then it will move to the left (when you press the left chevron 2 times). Any way to solve this problem? It must either move 2 slides, double-click, or cancel the second click, and when clicking the opposite direction, perform this action correctly.
source share