I’m trying to redirect one of my pages within the app but navigation is still displayed. I editing a data from a controller and displayed on another. I would like to edit the data and redirect, but the changes are reflected.
.factory('sessionService', ['$http', function($http) {
return {
set: function(key, value) {
return localStorage.setItem(key, JSON.stringify(value));
},
get: function(key) {
return JSON.parse(localStorage.getItem(key));
},
destroy: function(key) {
return localStorage.removeItem(key);
},
};
}])
.controller('AppCtrl', function($scope, $ionicModal, $timeout, sessionService, $location) {
$scope.loginData = {};
$scope.user_nombres = sessionService.get('user_nombres') + " " + sessionService.get('user_apellidos');
$scope.perfil = function() {
$location.path('/app/perfil');
}
})
.controller('App2Ctrl', function($scope, sessionService, '$location'){
sessionService.set('user_nombres' 'Test');
$location.path('/app/home');
})