mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
amend(slideBox): check index validity when select happens
This commit is contained in:
5
js/angular/controller/slideBoxController.js
vendored
5
js/angular/controller/slideBoxController.js
vendored
@@ -178,8 +178,6 @@ function(scope, element, $log, $document, $$q, $timeout, $interval, $$ionicAttac
|
||||
// adds data to the queue for selection.
|
||||
// Index can be either a number or a getter (to be called when starting the slide)
|
||||
function select(newIndex, transitionDuration, isDrag) {
|
||||
newIndex = parseInt(newIndex);
|
||||
if (isNaN(newIndex) || newIndex < 0) return;
|
||||
slideQueue.unshift([
|
||||
angular.isFunction(newIndex) ? newIndex : function() { return newIndex; },
|
||||
transitionDuration || SLIDE_TRANSITION_DURATION,
|
||||
@@ -233,8 +231,9 @@ function(scope, element, $log, $document, $$q, $timeout, $interval, $$ionicAttac
|
||||
}
|
||||
|
||||
function slideTo(newIndex, duration, isDrag) {
|
||||
newIndex = parseInt(newIndex);
|
||||
// Immediately finish invalid selection
|
||||
if (!self.isValidIndex(newIndex)) return $$q.when();
|
||||
if (isNaN(newIndex) || !self.isValidIndex(newIndex)) return $$q.when();
|
||||
|
||||
var deferred = $$q.defer();
|
||||
var delta = getDelta(selectedIndex, newIndex);
|
||||
|
||||
Reference in New Issue
Block a user