Function onload ion-view not working


#1

I was trying to do that every time you execute one of my controllers will execute a function, as an example I made a small function, this works only the first time, whereas if you re-enter the ion-view does not return to shit function. It was trying and data-init ng-ng-init but as loading and initialization data does not help me right now. Try also follows but nothing worked for me. There simulate target as “on-load” in ion-view or in my case, in tabs?

var init = function($scope){
  alert("Hi");
};
init();

My view

<script id="misviews.html" type="text/ng-template">
<ion-view>
<ion-tabs class="tabs-background-positive tabs-color-stable tabs-top tabs-striped" style="margin-bottom:20px;">
    <ion-tab title="Lista" style="font-weight: bold;">
      <ion-content lazy-scroll>
            //Here 
      </ion-content>
    </ion-tab>
    <ion-tab title="Mapa" style="font-weight: bold;">
      <ion-content class="map-container">

      </ion-content>
    </ion-tab>
</ion-tabs>

#2

I could not explain well what I needed but fixed. I was checking and the term ng-init="" is for data load and no function. I also found that ionic offers certain methods for the views. In those which I found was my mistake and it was not necessary to occupy the policies that I wanted to take. Here is the link and which served me.

$scope.$on('$ionicView.enter', function(){

});