More slide stuff working

This commit is contained in:
Max Lynch
2013-12-16 09:52:03 -06:00
parent 8d42f856da
commit 196e015015
8 changed files with 123 additions and 48 deletions

View File

@@ -20,7 +20,10 @@ angular.module('ionic.ui.slideBox', [])
restrict: 'E',
replace: true,
transclude: true,
scope: {},
scope: {
showPager: '@',
onSlideChanged: '&'
},
controller: ['$scope', '$element', function($scope, $element) {
var _this = this;
@@ -28,10 +31,13 @@ angular.module('ionic.ui.slideBox', [])
el: $element[0],
slidesChanged: function() {
$scope.currentSlide = slider.getPos();
// Occasionally we need to trigger a digest
$timeout(function() {});
},
callback: function(slideIndex) {
$scope.currentSlide = slideIndex;
$scope.onSlideChanged({index:$scope.currentSlide});
$scope.$parent.$broadcast('slideBox.slideChanged', slideIndex);
$scope.$apply();
}
@@ -51,7 +57,7 @@ angular.module('ionic.ui.slideBox', [])
link: function($scope, $element, $attr, slideBoxCtrl) {
// If the pager should show, append it to the slide box
if($attr.showPager !== "false") {
if($scope.$eval($scope.showPager) !== false) {
var childScope = $scope.$new();
var pager = angular.element('<pager></pager>');
$element.append(pager);