mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(ionSlideBox): add 'auto-play' attr to optionally disable auto-play
Closes #1552
This commit is contained in:
7
js/angular/directive/slideBox.js
vendored
7
js/angular/directive/slideBox.js
vendored
@@ -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],
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user