3
I’m developing a system using angular js and php. The user inserts his Cpf and his password in a form, remembering that this user is registered in the database with his information, such as, address, name, etc. When user type his credentials, I take this data by js angular and forward to php using $http.post('php/login.php',user);
.
If the user’s Cpf is found in the database, I want it to return a JSON
with all user data and pass by parameter using the ngRoute
with $location.path('pagina',+dados_usuarios)
:
$http.get('php/login.php', user).success(function(data) {
var result = JSON.stringify(data, null, 2);
console.log(result);
//$location.path('/dashboard/'+result);
}).error(function(data) {
console.log("Usuário não cadastrado!");
});
PHP is returning json to me, but how can I use this json on another Angular JS page ?
You are using ui-router or ngRouter?
– adelmo00
I’m using the ngRouter.
– System789
See if you can get help http://stackoverflow.com/questions/25486392/best-way-to-pass-data-between-ngroute-controllers-from-one-view-to-the-next
– adelmo00
later put a fiddle with example ...
– pmargreff