@alexcandy91 wrote:
Hello,
I'm developing an application with Ionc framework ( of course ), and I have a problem. I would like to initialize some variables and execute some function every time I open a view. I'm using $stateProvider methods in the app configuration in order to initialize all routes and I try to use ionic events like this to intercept the opening of the view...
$scope.$on("$ionicView.enter", function(event, data){
// handle event
alert("State Params: ", data.stateParams);
});But it works only on a login controller. I try to read a lot of post but no one can give to me a solution. To be sure I also put the app configuration view and the first part of the controller, I hope that someone can help me.
`
angular.module('indexController', [])
.controller('faceIndexCtrl',
function ($scope, $ionicModal, $translate, localstorage, happyBack, $timeout, $state,$ionicPopup, $http, $ionicPlatform, $state, $animate, soundEffects, $rootScope) {$scope.$on("$ionicView.beforeEnter", function(event, data){ // handle event alert("State Params: ", data.stateParams); }); $scope.$on("$ionicView.enter", function(event, data){ // handle event alert("State Params: ", data.stateParams); }); $scope.$on("$ionicView.afterEnter", function(event, data){ // handle event alert("State Params: ", data.stateParams); });
...so on...
`Thank you so much!
Posts: 1
Participants: 1