angularjs - load function always run controller -
each time controller runs need load function init() not working.
<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> </ion-content> </ion-tab> <ion-tab title="mapa" style="font-weight: bold;"> <ion-content class="map-container"> </ion-content> </ion-tab> </ion-tabs> </ion-view> </script> this ion-view, 2 tabs. need load function whenever driver, first work, allowed run , not update need start.
.controller('misviewsctrl', function($scope)){ $scope.init = function(){ alert("hi"); } $scope.init(); } i tried code, ng-init="init();", , data-ng-init="init();" , none of worked.
i not explain needed fixed. checking , term ng-init="" data load , no function. found ionic offers methods views. in found mistake , not necessary occupy policies wanted take. here link , served me.
$scope.$on('$ionicview.enter', function(){ });
Comments
Post a Comment