Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: $ionicSlideBoxDelegate.currentIndex return object #3260

Closed
ag-secret opened this issue Mar 9, 2015 · 1 comment
Closed

bug: $ionicSlideBoxDelegate.currentIndex return object #3260

ag-secret opened this issue Mar 9, 2015 · 1 comment

Comments

@ag-secret
Copy link

Type: bug

Platform: desktop browser

I have a slidebox with events values from a webservice. On event afterEnter I'm refreshing the events from slidebox and updating, so when I call the currentIndex I'm getting an object or something like that.

    $scope.events = [];
$scope.$on('$ionicView.afterEnter', function(){
    $scope.firstRefresh();
});

$scope.firstRefresh = function(){
    $scope.showFirstRefresh = true;
    $timeout(function(){
        Evento.get()
            .then(function(result){
                $scope.events = result;
                $ionicSlideBoxDelegate.update();
                    console.log($ionicSlideBoxDelegate.currentIndex); <--- HERE
            }, function(err){

            })
            .finally(function(){
                $scope.showFirstRefresh = false;
            });
    }, 1000);
};

What I'm getting on Chrome console:

  function caller() {
      var handle = this.handle;
      var args = arguments;
      var foundInstancesCount = 0;
      var returnValue;

      this._instances.forEach(function(instance) {
        if ((!handle || handle == instance.$$delegateHandle) && instance.$$filterFn(instance)) {
          foundInstancesCount++;
          var ret = instance[methodName].apply(instance, args);
          //Only return the value from the first call
          if (foundInstancesCount === 1) {
            returnValue = ret;
          }
        }
      });

      if (!foundInstancesCount && handle) {
        return $log.warn(
          'Delegate for handle "' + handle + '" could not find a ' +
          'corresponding element with delegate-handle="' + handle + '"! ' +
          methodName + '() was not called!\n' +
          'Possible cause: If you are calling ' + methodName + '() immediately, and ' +
          'your element with delegate-handle="' + handle + '" is a child of your ' +
          'controller, then your element may not be compiled yet. Put a $timeout ' +
          'around your call to ' + methodName + '() and try again.'
        );
      }
      return returnValue;
    }</span>

@ajoslin
Copy link
Contributor

ajoslin commented Apr 14, 2015

$ionicSlideBoxDelegate.currentIndex() is a function you have to call. It returns a number.

@ajoslin ajoslin closed this as completed Apr 14, 2015
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants