Tenho o seguinte código:
.controller('cadastroCtrl', ['$scope', '$stateParams', '$http', function ($scope, $stateParams, $http, $cordovaSQLite, $window, $state) {
$scope.emailCli = [];
$scope.emailPro = [];
$scope.cadastrar = function(usuario){
$http.post("http://ec2-54-68-29-61.us-west-2.compute.amazonaws.com/auth/register", usuario).success(function(response){
var name = response.user.name;
var email = response.user.email;
var id = response.user.id;
var is_professional = response.user.is_professional;
if(typeof(Storage) !== "undefined"){
if(is_professional == true){
localStorage.setItem('userPro', name);
$scope.emailPro = localStorage.setItem('emailPro', email);
localStorage.setItem('idPro', id);
console.log('Professional');
$state.go('menuProfissional');
}else{
localStorage.setItem('userCli', name);
$scope.emailCli = localStorage.setItem('emailCli', email);
localStorage.setItem('idCli', id);
console.log('Client');
$state.go('menuCliente');
}
}else{
console.log("Desculpe, mas o navegador nao possui suporte a Web Storage.");
}
})
}
}])
E no route.js
.state('menuCliente', {
url: '/menuCliente',
templateUrl: 'templates/menuCliente.html',
controller: 'menuClienteCtrl'
})
.state('menuProfissional', { url: '/menuProfissional', templateUrl: 'templates/menuProfissional.html', controller: 'menuProfissionalCtrl' })
E o seguinte aviso de erro aparece no console:
Cannot read property 'go' of undefined
O que estou fazendo de errado?