Ionic View events not fired when using nested views


#1

This app has a total of 5 states, 2 of which are abstract:

  1. Menu (abstract)
  2. Parent (abstract) < Menu
  3. Child1 < Parent
  4. Child2 < Parent
  5. Parent’s sibling < Menu

There seems to be a bug when trying to listen to the ionicView.leave event for the Child1. Here is the sequence that triggers the faulty behavior:

  1. Visit Child1
  • Child1 sets a listener for the ionicView.leave event
  1. Visit Parent’s Sibling.
  2. Leave event is not fired, as expected. :frowning:
  3. Visit Child2
  4. Leave event from Child1 is fired? :exclamation: :expressionless:

This is using the latest version of ionic.

Any suggestions? Is this not supported by ionic? Or is this a bug with angular-ui?


#2

It seems that the problem is using $scope.$on in the Child controller.
The event is not received by Child1’s scope, but rather the Parent ($scope.$parent) scope. I’m still not sure if this is technically a bug or not, but it seems like there is no way to know if the Child view has been changed.


$ionicView.beforeLeave not firing
$ionicView events not firing