ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.94k stars 13.52k forks source link

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

Closed ericraio closed 9 years ago

ericraio commented 9 years ago

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.

perrygovier commented 9 years ago

Could you demonstrate this in a codepen?

hur0n commented 9 years ago

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

dellheng commented 9 years ago

+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

hur0n commented 9 years ago

@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.

dellheng commented 9 years ago

@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 commented 9 years ago

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

Ionitron commented 9 years ago

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 commented 9 years ago

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.

Elsioufy commented 9 years ago

+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)
karthikiyengar commented 9 years ago

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

JavierMartinz commented 9 years ago

+1 breaks with slide() on 1.0.1

karthikiyengar commented 9 years ago

Reopened as #4041

stephanbarrett commented 9 years ago

+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!

JunkMyFunk commented 9 years ago

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

karthikiyengar commented 8 years ago

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);
RameshJhajharia commented 8 years ago

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.

rajeshwarpatlolla commented 8 years ago

+1 Same issue even after trying the above solutions.

marlonmantilla commented 7 years ago

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