Skip to content

Commit

Permalink
feat(ionSlideBox): add 'auto-play' attr to optionally disable auto-play
Browse files Browse the repository at this point in the history
Closes #1552
  • Loading branch information
joilsonmarques authored and ajoslin committed Jul 7, 2014
1 parent 2e9d096 commit 8f80860
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions js/angular/directive/slideBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -45,6 +46,7 @@ function($timeout, $compile, $ionicSlideBoxDelegate) {
replace: true,
transclude: true,
scope: {
autoPlay: '=',
doesContinue: '@',
slideInterval: '@',
showPager: '@',
Expand All @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion test/html/slideBox.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit 8f80860

Please sign in to comment.