Closed Mr-Luo closed 8 years ago
same issue here
Same error received using the $ionicModal service and setting the scope option. $ionicSlideBoxDelegate only seems to work here when the default scope is used ($rootScope). Not a solution, but a temporary one at least.
Updating the condition to following in ionic.bundle.js ( function 'setup' ) worked for me.
// do not setup if the container has no width
if (!container.offsetWidth && !element.children.length) {
return;
}
Thanks a lot @srinivas-gangji. I had the same problem and your solution worked very well for me.
Thanks @srinivas-gangji it solve my problem too. Are we making wrong usage of $ionicSlideBoxDelegate or should it be patch ?
This fixes the issue for me too but I don't want to be editing the bundle file. @srinivas-gangji did you want to put in a PR?
thanks @srinivas-gangji
if you are using a ionicModal and the content of the slides are rendered with ng-repeat, be sure the content is already rendered before moving to a slide with the .slide(index) function. since the modal.show() returns a promise, I use a .then(), like:
$scope.modal.show().then(function(){
$ionicSlideBoxDelegate.slide( index );
});
where $scope.modal is an instance of IonicModal .... i hope it was helpfull
Hey everyone, we just landed a new slider component that solves this issue. It's in master and will be in 1.2 To use it today, do this:
Will be back porting the delegate to work with it soon, but going to close since this should be solved now.
<ion-slides options="options" slider="data.slider">
<ion-slide-page>
</ion-slide-page>
</ion-slides>
and your JS:
controller('MyCtrl', function($scope) {
$scope.options = {
loop: true
}
$scope.data = {};
$scope.$watch('data.slider', function(nv, ov) {
$scope.slider = $scope.data.slider;
})
$timeout(function() {
$scope.slider.slideTo(index);
}, 1000)
});
The suggestion of Mr. Slzr worked perfectly. Thank you so much.
Type: BUG
Platform: mobile webview
hi,when i Call $ionicSlideBoxDelegate.slide(index) in modal it cause " Uncaught TypeError: Cannot read property 'length' of undefined" circle @ ionic.bundle.js:8178slide @ ionic.bundle.js:8207ionic.views.Slider.ionic.views.View.inherit.initialize.slide.select @ ionic.bundle.js:8560(anonymous function) @ ionic.bundle.js:105caller @ ionic.bundle.js:102$http.get.success.$ionicModal.fromTemplateUrl.then.$scope.showNumber @ app.js:271$parseFunctionCall @ ionic.bundle.js:21172$get.isolateBindingContext.(anonymous function) @ ionic.bundle.js:16519IonicModule.directive.controller.ionic.views.Slider.callback @ ionic.bundle.js:54513ionic.views.Slider.ionic.views.View.inherit.initialize.events.end @ ionic.bundle.js:8489ionic.views.Slider.ionic.views.View.inherit.initialize.events.handleEvent @ ionic.bundle.js:8326