Fixed #288, added carousel support to slide box

Also fixed evevt bubbling and incorrect iOS 7 detection in mobile safari
This commit is contained in:
Max Lynch
2013-12-18 12:21:52 -06:00
parent c7b84f5204
commit e1ae338b51
10 changed files with 257 additions and 73 deletions

View File

@@ -22,15 +22,22 @@ angular.module('ionic.ui.slideBox', [])
transclude: true,
scope: {
doesContinue: '@',
slideInterval: '@',
showPager: '@',
disableScroll: '@',
onSlideChanged: '&'
},
controller: ['$scope', '$element', function($scope, $element) {
var _this = this;
var continuous = $scope.$eval($scope.doesContinue) === true;
var slideInterval = continuous ? $scope.$eval($scope.slideInterval) || 4000 : 0;
var slider = new ionic.views.Slider({
el: $element[0],
continuous: $scope.$eval($scope.doesContinue) === true,
auto: slideInterval,
disableScroll: ($scope.$eval($scope.disableScroll) === true) || false,
continuous: continuous,
slidesChanged: function() {
$scope.currentSlide = slider.getPos();
@@ -59,7 +66,11 @@ angular.module('ionic.ui.slideBox', [])
slider.slide(index);
});
$scope.slideBox = slider;
$scope.$parent.slideBox = slider;
this.getNumSlides = function() {
return slider.getNumSlides();
};
$timeout(function() {
slider.load();
@@ -85,14 +96,11 @@ angular.module('ionic.ui.slideBox', [])
.directive('slide', function() {
return {
restrict: 'E',
replace: true,
require: '^slideBox',
transclude: true,
template: '<div class="slider-slide" ng-transclude></div>',
compile: function(element, attr, transclude) {
return function($scope, $element, $attr, slideBoxCtrl) {
};
}
compile: function(element, attr) {
element.addClass('slider-slide');
return function($scope, $element, $attr) {};
},
};
})
@@ -116,7 +124,7 @@ angular.module('ionic.ui.slideBox', [])
};
$scope.numSlides = function() {
return new Array($scope.slideBox.getNumSlides());
return new Array(slideBox.getNumSlides());
};
$scope.$watch('currentSlide', function(v) {