I have a simple angular js ionic application. When I route for the first time to a view then the init function gets called. However any subsequent visits to the same view do not call the init function. I know this is probably called because cache is set to true by default on the app:
.state('app', {
url: "/app",
templateUrl: "templates/mainpage.html",
controller : "appController"
})
A simple controller:
angular.module('starter.controllers', []).controller('appController', function($scope) {
var init = function() { alert("test"); }
});
My index.html:
<body ng-app="starter" class="ng-cloak">
<ion-nav-view></ion-nav-view>
</body>
How can I make sure that init gets called each time the view is loaded?