Ion controller is not called after $ state.go

I have a controller that receives data from my external application, when I first open the state from the first controller, it downloads data, but when it tries to open it again, it does not load new data

that's how

if (selectedServiceID == "000") { $state.go('balanceInquery'); }; 

here the balanceInquery state controller is called

 .controller('BalanceInqueryController', function($scope, getAccountBalanceService, $state, $ionicLoading, $ionicPopup) { getAccountBalanceService.get(username, pass, customerID, serviceAccID, langID) .success(function(data) { $scope.custBalance = data; }) .error(function(data) { var alertPopup = $ionicPopup.alert({ title: 'Error!', template: 'Sorry something went wrong' }); }); }) 
+5
source share
2 answers

I had a similar problem. The first time was shown only after a reboot. The reason is view caching. Disable it with cache: false , as in my specific case:

 $stateProvider .state('login', { url: '/login', controller: 'LoginCtrl as vm', templateUrl: 'app/login/login.html' }) .state('tab', { url: '/tab', abstract: true, templateUrl: 'templates/tabs.html', cache: false }) 
+9
source

This is due to viewing caching, which can be disabled in various ways. See http://ionicframework.com/docs/nightly/api/directive/ionNavView/ for details.

+3
source

Source: https://habr.com/ru/post/1215863/


All Articles