$ionicSlideBoxDelegate
Delegate that controls the ionSlideBox
directive.
Methods called directly on the $ionicSlideBoxDelegate service will control all slide boxes. Use the $getByHandle method to control specific slide box instances.
Usage
<ion-view>
<ion-slide-box>
<ion-slide>
<div class="box blue">
<button ng-click="nextSlide()">Next slide!</button>
</div>
</ion-slide>
<ion-slide>
<div class="box red">
Slide 2!
</div>
</ion-slide>
</ion-slide-box>
</ion-view>
function MyCtrl($scope, $ionicSlideBoxDelegate) {
$scope.nextSlide = function() {
$ionicSlideBoxDelegate.next();
}
}
Methods
update()
Update the slidebox (for example if using Angular with ng-repeat, resize it for the elements inside).
slide(to, [speed])
Param | Type | Details |
---|---|---|
to |
number
|
The index to slide to. |
speed
(optional)
|
number
|
The number of milliseconds the change should take. |
enableSlide([shouldEnable])
Param | Type | Details |
---|---|---|
shouldEnable
(optional)
|
boolean
|
Whether to enable sliding the slidebox. |
- Returns:
boolean
Whether sliding is enabled.
previous([speed])
Go to the previous slide. Wraps around if at the beginning.
Param | Type | Details |
---|---|---|
speed
(optional)
|
number
|
The number of milliseconds the change should take. |
next([speed])
Go to the next slide. Wraps around if at the end.
Param | Type | Details |
---|---|---|
speed
(optional)
|
number
|
The number of milliseconds the change should take. |
stop()
Stop sliding. The slideBox will not move again until explicitly told to do so.
start()
Start sliding again if the slideBox was stopped.
currentIndex()
- Returns: number The index of the current slide.
slidesCount()
- Returns: number The number of slides there are currently.
$getByHandle(handle)
Param | Type | Details |
---|---|---|
handle |
string
|
- Returns:
delegateInstance
A delegate instance that controls only theionSlideBox
directives withdelegate-handle
matching the given handle.
Example: $ionicSlideBoxDelegate.$getByHandle('my-handle').stop();