Event to detect focus/blur of a screen in ionic



I am new to ionic + angular and need some help.

I want to know is there any event on which I can listen to find out when my view is shown or goes out of focus.
Basically I have few screens and I want to do some processing only when a screen is shown to the user. If I navigate away from the screen, I want to stop my processing.

Any pointers will be of great help.



What you can do is have that processing be tied to controller and attach that controller to a specific view.

.controller ('Process', function ($scope) {
  $scope.process = function (){
    //Some Processing stuff