0
I created a login form. I’m almost done authenticating and all that’s left is to be able to redirect the user to the right page.
Angularjs:
app.controller("LoginController", function ($scope, $http, $state) {
$scope.loginInfo = {
nome: undefined,
senha: undefined
}
$scope.loginUser = function () {
var data = {
nome: $scope.loginInfo.nome,
senha: $scope.loginInfo.senha
}
$http.post("admin/php/login.php", data).then(function(response){
//console.log(response);
$state.go("admin/views/painel", response);
}).catch(function(error){
console.error(error);
});
//})
}
});
Someone knows how to do it?
Use $Location.path('admin/views/panel')
– Danilo Miguel
This appeared on the console: "$Location is not defined(...)"
– GustavoSevero
Add to your controller looking like this: app.controller("Logincontroller", Function($Scope,$http,$state,$Location)
– Danilo Miguel
It worked. Thanks.
– GustavoSevero