After registering, I'm temporarily wanting to put some data in localStorage, but I'm not getting it.
Follow my code:
app.controller('cadastroCtrl', ['$scope', '$stateParams', '$http', '$cordovaSQLite', '$window', '$state', function ($scope, $stateParams, $http, $cordovaSQLite, $window, $state) {
$scope.email = [];
$scope.cadastrar = function(usuario){
$http.post("http://vigilantescomunitarios.com/serviapp/api_gustavo/register.php", usuario).success(function(response){
var nome = response.nome;
var email = response.email;
var id = response.idusuario;
var is_professional = response.prof;
if(typeof(Storage) !== "undefined"){
if(is_professional == 1){
$window.localStorage.setItem('userPro', nome);
$scope.email = $window.localStorage.setItem('emailPro', email);
$window.localStorage.setItem('idPro', id);
console.log('Profissional');
$state.go('menuProfissional');
}else{
$window.localStorage.setItem('userCli', nome);
$scope.email = $window.localStorage.setItem('emailCli', email);
$window.localStorage.setItem('idCli', id);
console.log('Cliente');
$state.go('menuCliente');
}
}else{
console.log("Desculpe, mas o navegador nao possui suporte a Web Storage.");
}
})
}
}])