$ionicView.beforeLeave is called after $ionicView.beforeEnter



I am listening to $ionicView.beforeLeave and $ionicView.beforeEnter on the controller of abstract state. That abstract state holds child states for tabs. When I am switching tabs I get console log from $ionicView.beforeEnter first. Is this expected?

Child state beforeenter called before parent state beforeenter called

Not sure if this can be avoided or not, but I had a similar problem. I had some controllers that needed to keep the screen awake. My logic was to disable screen awake when the controller exited. The problem was “onEnter” for a new controller was being called before onLeave of the current controller which kept causing problems. I had to change my logic to work around this problem