ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: $ionicSlideBoxDelegate.next() causing an exception after upgrading to 1.0.0

Open ericraio opened this issue 11 years ago • 18 comments

Type: bug

Platform: mobile webview

I just upgraded to 1.0.0 yay me but this is the only thing I can't figure out.

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.

ericraio avatar May 22 '15 05:05 ericraio

Could you demonstrate this in a codepen?

perrygovier avatar May 22 '15 19:05 perrygovier

I have exactly the same problem since I upgraded to 1.0.0 with $ionicSlideBoxDelegate.next() and $ionicSlideBoxDelegate.slide(to)

hur0n avatar Jun 16 '15 06:06 hur0n

+1 this right in rc3, but 1.0.0 throw exception

TypeError: Cannot read property 'length' of undefined
    at circle (http://code.ionicframework.com/1.0.0/js/ionic.bundle.js:8050:21)
    at slide (http://code.ionicframework.com/1.0.0/js/ionic.bundle.js:8077:30)
    at slide.select (http://code.ionicframework.com/1.0.0/js/ionic.bundle.js:8432:7)
    at http://code.ionicframework.com/1.0.0/js/ionic.bundle.js:105:46
    at Array.forEach (native)
    at DelegateInstance.caller [as slide] (http://code.ionicframework.com/1.0.0/js/ionic.bundle.js:102:27)
    at Scope.$scope.goToSlide (http://s.codepen.io/boomerang/7b326cd8cdc0ad67565a76f3b14ea6051434449898271/index.html:162:36)
    at $parseFunctionCall (http://code.ionicframework.com/1.0.0/js/ionic.bundle.js:21044:18)
    at http://code.ionicframework.com/1.0.0/js/ionic.bundle.js:53458:9
    at Scope.$eval (http://code.ionicframework.com/1.0.0/js/ionic.bundle.js:23100:28)

http://codepen.io/dellheng/pen/QbMaaN

dellheng avatar Jun 16 '15 10:06 dellheng

@dellheng Your codepen is working!? I dont see the TypeError in your example? I am also struggling to reproduce this in a codepen example, however, I can confirm that I get the "undefined slides" after rc3 in my project.

hur0n avatar Jun 16 '15 18:06 hur0n

@hur0n Sorry I didn't say how to click button,It's very strange。 You didn't see error in this order:

  1. click "Show images from start" button
  2. click "Show second imagen"

You will see error in this order:

  1. click "Show second imagen"
  2. click "Show images from start" button

and the error only appear in first time ,you click again,the error won't appear

dellheng avatar Jun 17 '15 03:06 dellheng

@hur0n This is rc3 demo http://codepen.io/dellheng/pen/mJMzvR It's OK

dellheng avatar Jun 17 '15 04:06 dellheng

Greetings @ericraio!

My sensors indicate a reply was requested, but we have not received one yet, I am using my robot powers to close this issue. However, if you are still experiencing this issue, please feel free to reopen it by creating a new issue, and include any examples or necessary information.

Thank you for allowing me to assist you.

Ionitron avatar Jun 21 '15 22:06 Ionitron

Greetings @ericraio!

My sensors indicate a reply was requested, but we have not received one yet, I am using my robot powers to close this issue. However, if you are still experiencing this issue, please feel free to reopen it by creating a new issue, and include any examples or necessary information.

Thank you for allowing me to assist you.

Ionitron avatar Jun 21 '15 22:06 Ionitron

+1 I have the same issue when I upgraded to ionic 1.0.0

trying to call:

$ionicSlideBoxDelegate.next()

It gives an exception:

TypeError: Cannot read property 'length' of undefined
  at next (http://192.168.1.132:8100/lib/ionic/release/js/ionic.bundle.js:8043:30)
  at next (http://192.168.1.132:8100/lib/ionic/release/js/ionic.bundle.js:8446:7)
  at http://192.168.1.132:8100/lib/ionic/release/js/ionic.bundle.js:105:46
  at Array.forEach (native)
  at DelegateInstance.caller [as next] (http://192.168.1.132:8100/lib/ionic/release/js/ionic.bundle.js:102:27)

Elsioufy avatar Jun 28 '15 11:06 Elsioufy

+1, breaks on next(), previous(), slide(). Can someone reopen this issue? Downgraded to RC3.

karthikiyengar avatar Jun 28 '15 15:06 karthikiyengar

+1 breaks with slide() on 1.0.1

JavierMartinz avatar Jul 05 '15 15:07 JavierMartinz

Reopened as #4041

karthikiyengar avatar Jul 06 '15 04:07 karthikiyengar

+1

I'm having the same issue and myself and my team can't figure out how to fix this. Anyone have an example of how to get around this bug in 1.0.1/1.1?

Thanks!

stephanbarrett avatar Aug 17 '15 19:08 stephanbarrett

I get the same issue using $ionicSlideBoxDelegate.next();. It seems that adding delegate-handle="slider" to the <ion-slide-box> in the template and referencing it using $ionicSlideBoxDelegate.$getByHandle('slider').next(); and $ionicSlideBoxDelegate.$getByHandle('slider').previous(); work reliably in 1.1.0 though

JunkMyFunk avatar Sep 08 '15 10:09 JunkMyFunk

JunkMyFunk - your solution does not seem to work for me, although I found an ugly-hack way to fix it using a timeout (v1.1.0).

$timeout(function() {
    $ionicSlideBoxDelegate.$getByHandle('photos').slide(index);
},   100);

karthikiyengar avatar Oct 02 '15 13:10 karthikiyengar

Getting same issue at $ionicSlideBoxDelegate.next();. The strange thing is that it is working at one place in my app but not working in another app.

RameshJhajharia avatar Oct 06 '15 08:10 RameshJhajharia

+1 Same issue even after trying the above solutions.

rajeshwarpatlolla avatar Jan 04 '16 17:01 rajeshwarpatlolla

Having same issue here too, neither of the solutions above worked for me.

marlonmantilla avatar Oct 24 '16 20:10 marlonmantilla