How to turn off eventListeners for inactive views



Within many views I am listening to keyboard events. I would like to limit listening to only currently active state. I have tried using ionic.EventController.on and ionic.on but they seem to be just a thin wrapper around classic eventListener. I have also tried listening for the events on ion-view tag but it seems that they are only send to the window object.

I am aware that I can workaround usting active/inactive flag for each controller I care about but I would like to know if there is ionic or angular specific mechanism for that.

Thanks in advance