@@ -134,8 +134,9 @@ angular.module('ionic.ui.slideBox', [])
134
134
* @param {boolean= } does-continue Whether the slide box should automatically slide.
135
135
* @param {number= } slide-interval How many milliseconds to wait to change slides (if does-continue is true). Defaults to 4000.
136
136
* @param {boolean= } show-pager Whether a pager should be shown for this slide box.
137
+ * @param {expression= } pager-click Expression to call when a pager is clicked (if show-pager is true). Is passed the 'index' variable.
137
138
* @param {boolean= } disable-scroll Whether to disallow scrolling/dragging of the slide-box content.
138
- * @param {expression= } on-slide-changed Expression called whenever the slide is changed.
139
+ * @param {expression= } on-slide-changed Expression called whenever the slide is changed. Is passed an 'index' variable.
139
140
* @param {expression= } active-slide Model to bind the current slide to.
140
141
*/
141
142
. directive ( 'ionSlideBox' , [
@@ -151,6 +152,7 @@ function($timeout, $compile, $ionicSlideBoxDelegate) {
151
152
doesContinue : '@' ,
152
153
slideInterval : '@' ,
153
154
showPager : '@' ,
155
+ pagerClick : '&' ,
154
156
disableScroll : '@' ,
155
157
onSlideChanged : '&' ,
156
158
activeSlide : '=?'
@@ -205,13 +207,17 @@ function($timeout, $compile, $ionicSlideBoxDelegate) {
205
207
this . __slider = slider ;
206
208
207
209
var deregisterInstance = $ionicSlideBoxDelegate . _registerInstance ( slider , $attrs . delegateHandle ) ;
208
-
209
210
$scope . $on ( '$destroy' , deregisterInstance ) ;
210
211
211
212
this . slidesCount = function ( ) {
212
213
return slider . slidesCount ( ) ;
213
214
} ;
214
215
216
+ this . onPagerClick = function ( index ) {
217
+ console . log ( 'pagerClick' , index ) ;
218
+ $scope . pagerClick ( { index : index } ) ;
219
+ } ;
220
+
215
221
$timeout ( function ( ) {
216
222
slider . load ( ) ;
217
223
} ) ;
@@ -239,7 +245,8 @@ function($timeout, $compile, $ionicSlideBoxDelegate) {
239
245
require : '^ionSlideBox' ,
240
246
compile : function ( element , attr ) {
241
247
element . addClass ( 'slider-slide' ) ;
242
- return function ( $scope , $element , $attr ) { } ;
248
+ return function ( $scope , $element , $attr ) {
249
+ } ;
243
250
} ,
244
251
} ;
245
252
} )
@@ -249,7 +256,7 @@ function($timeout, $compile, $ionicSlideBoxDelegate) {
249
256
restrict : 'E' ,
250
257
replace : true ,
251
258
require : '^ionSlideBox' ,
252
- template : '<div class="slider-pager"><span class="slider-pager-page" ng-repeat="slide in numSlides() track by $index" ng-class="{active: $index == currentSlide}"><i class="icon ion-record"></i></span></div>' ,
259
+ template : '<div class="slider-pager"><span class="slider-pager-page" ng-repeat="slide in numSlides() track by $index" ng-class="{active: $index == currentSlide}" ng-click="pagerClick($index)" ><i class="icon ion-record"></i></span></div>' ,
253
260
link : function ( $scope , $element , $attr , slideBox ) {
254
261
var selectPage = function ( index ) {
255
262
var children = $element [ 0 ] . children ;
@@ -263,6 +270,10 @@ function($timeout, $compile, $ionicSlideBoxDelegate) {
263
270
}
264
271
} ;
265
272
273
+ $scope . pagerClick = function ( index ) {
274
+ slideBox . onPagerClick ( index ) ;
275
+ } ;
276
+
266
277
$scope . numSlides = function ( ) {
267
278
return new Array ( slideBox . slidesCount ( ) ) ;
268
279
} ;
0 commit comments