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

instanceMethodCaller throwing errors when this._instances is undefined

Open MundakaZgz opened this issue 11 years ago • 4 comments

I have just updated to beta 14 and I am getting a new error where there wasn't in beta 13.

The error I'm getting is "TypeError: Cannot read property 'forEach' of undefined" in line 95 of ionic.js. Apparently the instanceMethodCaller is not checking if there are instances to loop prior to use the forEach function.

MundakaZgz avatar Dec 18 '14 14:12 MundakaZgz

Hey @MundakaZgz, what are you looping over that is undefined, or what ionic component/service is causing this? Would you be able to post a codepen to demonstrate the issue?

drewrygh avatar Dec 18 '14 21:12 drewrygh

Greetings, @MundakaZgz!

My sensors indicate that more information is required so that I may assist you.

  • Can you provide a detailed description of this issue?
  • How would a robot go about replicating this issue?
  • What platform does this happen on? (iOS, Android, all, etc.)
  • What platform versions does this happen on? (Android 4.2, iOS 7, all, etc.)
  • Is this an issue with the Ionic Framework, or Ionic CLI?

Additionally, providing a codepen which replicates the issue is extremely helpful.

If you wish to get help using the framework itself, the recommended place is the forum.

Thank you for allowing me to assist you.

Ionitron avatar Dec 31 '14 15:12 Ionitron

Just ran into the same issue after updating to beta 14. In case anyone else stumbles upon this, the issue came down to a delegate not getting bound to this properly.

Old:

$scope.$watch($ionicSideMenuDelegate.isOpen, function (isOpen) {
  // do something
});

New:

var isSideMenuOpen = $ionicSideMenuDelegate.isOpen.bind($ionicSideMenuDelegate);
$scope.$watch(isSideMenuOpen, function(isOpen) {
  // do something
});

vgmcglaughlin avatar Feb 04 '15 16:02 vgmcglaughlin

I've just hit the same issue migrating to rc5. The solution above worked for me, thanks for posting it.

bpevangelista avatar Apr 30 '15 06:04 bpevangelista