I am using a module called angular-slick-carousel
, and have numerous items and I show the user what slide they are on and out of how many:
1 out of 10
user clicks on next arow
2 out of 10
The data is displayed in the carousel using Angular's ngRepeat
directive and use $index
to keep track of what slide the user is on, like so:
<slick data="$ctrl.phaseArr" settings="slickConfig">
<div ng-repeat="item in $ctrl.phaseArr">
<table>
<tr>
<th>Amber Renewal {{$index + 1}} of {{$ctrl.amberRenewals.length}}
</tr>
</table>
</div>
</slick>
Issue is that the carousel title which contains the index and total of items from the array, changes when the user clicks on the next button, rather than being static, and only the content changing.
I thought by updating the model when the user clicks on the arrow(or whole title area) and binding it to an element outside of the carousel would work, like so:
<div>
<p >Amber Renewal <span ng-bind="amberIndex"></span> of {{$ctrl.amberRenewals.length}}</p>
</div>
<slick data="$ctrl.phaseArr" settings="slickConfig">
<div ng-repeat="item in $ctrl.phaseArr">
<table>
<tr ng-init="amberIndex = 1" ng-click="amberIndex = 5">
<th>Amber Renewal {{$index + 1}} of {{$ctrl.amberRenewals.length}}
</tr>
</table>
</div>
</slick>
Though this did not work.
Question
How do I bind data to an element outside of ngRepeat
?