Closed karthikiyengar closed 8 years ago
We had this issue when we upgraded from beta 12 to 1.0.1
The reason was because we immediately assigned it to the scope in the controller like this
$scope.next = $ionicScrollDelegate.next;
But it worked if we hid it behind a method like
$scope.next = function () {
$ionicScrollDelegate.next();
});
I have the exact same issue. @Deminetix fix does not work for me, does anyone have any ideas?
Did you try delaying it's assignment?
May I know if there if the root cause of this issue is identified, so that we can go ahead and fix it?
I'm not really sure as to how hiding the next() call behind a function affects the functionality.
We are using this with no issues, and its been tested on our whole device suite. The act of hiding it behind a method which is called on $ionicView.enter allows the slidebox to initiate first. This is still a bug but it has a workaround. I'll have a look as to why this happens in the next week or so and report back
On Thu, Aug 6, 2015, 3:46 PM karthikiyengar notifications@github.com wrote:
May I know if there if the root cause of this issue is identified, so that we can go ahead and fix it?
I'm not really sure as to how hiding the next() call behind a function affects the functionality.
— Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic/issues/4041#issuecomment-128250973.
Thanks, @Deminetix. We have the same issue and have hid $ionicScrollDelegate.next(); behind a method but it doesn't fix the issue. Perhaps we're not calling it correctly from $ionicView.enter? Could you provide an example of how you're accomplishing that?
Thanks for your help!
Same problem here. The slide() method works when you try to open the first image and then the second image. It breaks when you try to slide to the second image and reports error 'Cannot read property 'length' of undefined'.
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.slideNext();
}, 1000)
});
$ionicView.enter also fix this issue.
Type: bug
Platform: all
When calling any function that moves to the next slide such as this one
$ionicSlideBoxDelegate.next()
This is the exception that I get...
TypeError: Cannot read property 'length' of undefined at circle (http://localhost:8100/vendor/ionic/js/ionic.bundle.js:8050:21) at slide (http://localhost:8100/vendor/ionic/js/ionic.bundle.js:8079:14) at ionic.views.Slider.ionic.views.View.inherit.initialize.slide.select (http://localhost:8100/vendor/ionic/js/ionic.bundle.js:8432:7) at http://localhost:8100/vendor/ionic/js/ionic.bundle.js:105:46 at Array.forEach (native) when diving into the code, the slides variable gets undefined.
Codepen: http://codepen.io/dellheng/pen/QbMaaN You will see error in this order:
The error only appear in first time the next() or slide() method is called for the first time. This does not happen on RC3 RC3 Pen (Works): http://codepen.io/dellheng/pen/mJMzvR
Please refer to the automatically closed issue: #3807