8
After finishing the data update, I want the system to redirect the user to another page. I am using ui-router and I was told to use $state.go. But how do I use this command?
Follows my code:
app.controller("AtualizarUsuarioController", function ($scope, $window, $http, $state) {
$scope.usuario = {
'id': $window.localStorage.getItem('idUsuarios'),
'nome': $window.localStorage.getItem('nome'),
'email': $window.localStorage.getItem('email')
}
//$location.path('/atualizarUsuario' + $scope.usuario.id);
$scope.atualizarUsuario = function (usuario) {
$http.post("admin/php/atualizarUsuario.php", usuario).then(function (data){
$state.go("/usuario");
});
};
});
What error message appears on console?
– Marco Aurélio Deleu
No error message appears.
– GustavoSevero
How do you know the code is coming in
$state.go('/usuario');
?– Marco Aurélio Deleu