feat(ionSlideBox): add 'auto-play' attr to optionally disable auto-play

Closes #1552
This commit is contained in:
Joilson Marques
2014-06-03 02:35:48 -03:00
committed by Andrew
parent 2e9d0965a5
commit 8f8086092f
2 changed files with 6 additions and 3 deletions

View File

@@ -27,7 +27,8 @@
*
* @param {string=} delegate-handle The handle used to identify this slideBox
* with {@link ionic.service:$ionicSlideBoxDelegate}.
* @param {boolean=} does-continue Whether the slide box should automatically slide.
* @param {boolean=} does-continue Whether the slide box should loop.
* @param {boolean=} auto-play Whether the slide box should automatically slide. Default true if does-continue is true.
* @param {number=} slide-interval How many milliseconds to wait to change slides (if does-continue is true). Defaults to 4000.
* @param {boolean=} show-pager Whether a pager should be shown for this slide box.
* @param {expression=} pager-click Expression to call when a pager is clicked (if show-pager is true). Is passed the 'index' variable.
@@ -45,6 +46,7 @@ function($timeout, $compile, $ionicSlideBoxDelegate) {
replace: true,
transclude: true,
scope: {
autoPlay: '=',
doesContinue: '@',
slideInterval: '@',
showPager: '@',
@@ -57,7 +59,8 @@ function($timeout, $compile, $ionicSlideBoxDelegate) {
var _this = this;
var continuous = $scope.$eval($scope.doesContinue) === true;
var slideInterval = continuous ? $scope.$eval($scope.slideInterval) || 4000 : 0;
var shouldAutoPlay = isDefined($attrs.autoPlay) ? !!$scope.autoPlay : true;
var slideInterval = shouldAutoPlay ? $scope.$eval($scope.slideInterval) || 4000 : 0;
var slider = new ionic.views.Slider({
el: $element[0],

View File

@@ -47,7 +47,7 @@
<ion-side-menus>
<ion-side-menu-content>
<ion-header-bar left-buttons="leftButtons" right-buttons="rightButtons" title=""></ion-header-bar>
<ion-slide-box on-slide-changed="slideChanged(index)" show-pager="true" pager-click="pagerClick(index)">
<ion-slide-box on-slide-changed="slideChanged(index)" show-pager="true" pager-click="pagerClick(index)" does-continue="true" auto-play="false">
<ion-slide ng-controller="FirstSlideCtrl">
<h3>Thank you for choosing the Awesome App!</h3>
<div id="logo">