I'm using ionic and I'm trying to create a multiview popup using ion-slide-box.
Everything works fine, until I get to the point where I have to check the current slide index.
Usually, you should be able to simply use modal.currentIndex(), but this doesn't work for me.
Here's what I get in the console:
Delegate for handle "modalSlider" could not find a corresponding element with delegate-handle="modalSlider"! currentIndex() was not called!
Now, I think it is a problem with the order all the elements are created and called in the page.
Here's some code: http://codepen.io/anon/pen/YqXBqN?editors=1010
angular.module('ionicApp', ['ionic'])
.controller('MyCtrl', ['$scope', '$ionicPopup', '$ionicSlideBoxDelegate', function($scope, $ionicPopup, $ionicSlideBoxDelegate) {
$scope.data = [{"id": 0,"name": "Element 0"}, {"id": 1,"name": "Element 1"}, {"id": 2,"name": "Element 2"}]
$scope.open = function() {
var myModal;
myModal = $ionicPopup.show({
title: "Are you sure?",
scope: $scope,
templateUrl: 'modal.html'
});
$scope.currentSlide = $ionicSlideBoxDelegate.$getByHandle('modalSlider').currentIndex();
$scope.next = function() {
$scope.currentSlide = $ionicSlideBoxDelegate.$getByHandle('modalSlider').currentIndex();
retu $ionicSlideBoxDelegate.$getByHandle('modalSlider').next();
}
$scope.prev = function() {
$scope.currentSlide = $ionicSlideBoxDelegate.$getByHandle('modalSlider').currentIndex();
retu $ionicSlideBoxDelegate.$getByHandle('modalSlider').previous();
}
$scope.close = function() {
myModal.close();
}
}
}])
As you can see, I also moved $scope.currentSlide=$ionicSlideBoxDelegate.$getByHandle('modalSlider').currentIndex() inside next and prev functions, and it works when called from here. The problem, as you can see in the pen, is that I need to check the current status when the popup appears. or i will always be behind the real index of the slider.
Any ideas with this? I caot use ionic modal, I must use ionic popup. Also, I'm open to any type of sulutions.
Thanks
