question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to use delegate-handle for several instances of ion-slide-box

See original GitHub issue

I have 3 ion-slide-box. Everyone has 3 items.

I created two buttons Next and back to simulate sliding by pressing them.

However delegate-handle doesn’t work. I get:

Delegate for handle "slider1" could not find a corresponding element with delegate-handle="slider1"! next() was not called!

Sounds like delegate-handle doesn’t register properly the instance ids.

This is what I have so far:

scope.nextSlider = function(sliderId){
         $timeout(function(){
             $ionicSlideBoxDelegate.$getByHandle(sliderId).next();
      }, 1000);       
      }

       scope.prevSlider = function(sliderId){         
         $timeout(function(){
             $ionicSlideBoxDelegate.$getByHandle(sliderId).previous();
      }, 1000);         
      } 

Template

 <ion-slide-box delegate-handle="{{sliderId}}" 
                       on-slide-changed="slideHasChanged(index)" 
                       show-pager="false">
      <ion-slide ng-repeat="color in colors">        
             <!-- -->
        </ion-slide>
    </ion-slide-box>

And this is a DEMO I play with

The issue was posted in Ionic Forum

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
panurge-wscommented, Feb 19, 2015

An universal directive to use random-generated delegate-handle (inspired to @mikesurowiec ) :

angular.module('app').directive('randomDelegateHandle', [function () {
  return {
    priority: 1000,
    restrict: 'A',
    compile: function compile(tElement, tAttrs, transclude) {
        tAttrs.$set('delegateHandle', Math.random().toString(36).substring(7));
        return function postLink(scope, iElement, iAttrs, controller) {}
    }
};

}]);

use:

ion-content random-delegate-handle
2reactions
thepi0commented, Aug 4, 2016

I had a similar problem and asked it in StackOverflow and got a great temporary solution to the problem. See it at StackOverflow. So basically set and get the delegate-handle by id of the container.

Hopefully this can help someone in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to use delegate-handle for several instances of ion ...
I have 2 ion-slide-box. Everyone has 3 items. I created two buttons Next and back to simulate sliding by pressing them.
Read more >
Ionic (angularjs) ion-slide-box with ng-repeat not updating
I have an ion-slide-box using ng-repeat showing images that are fetched from a remote server. <ion-slide-box on- ...
Read more >
Slide-box Dynamic Height - #20 by JonathanAquino - ionic-v1
Given a long text string, how can I paginate it across multiple slides? The number of characters per page is determined by container...
Read more >
Ionic Framework features you may have missed
Delegation allow you to have several instances of the same component within the same view. You have this capability on ion-side-menus, ion-tabs, ...
Read more >
How To Create An Advanced Ionic Gallery with Image Zooming
Take a look at everything, from outside to inside: The outer div is a wrapper for our modal view with some background styling;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found