mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
More slide stuff working
This commit is contained in:
10
js/ext/angular/src/directive/ionicSlideBox.js
vendored
10
js/ext/angular/src/directive/ionicSlideBox.js
vendored
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user