3
I’m using ANGULARJS/UI-ROUTES, and currently my application after logging only gets the email, I need to also come the ID of the logged-in user. The question of the routes I can, the problem is that it does not see the ID to bring. I think the problem may be in mine Claims?
follows code.
This is where I pass the id (which is null, because "user" only comes email)
<li ng-show="user"><a ui-sref="perfil({userId:user.id})">OLÁ, <em>{{ user }}</em></a></li>
Here is my controller that I try to get the id of the parameter that passes, but only comes null because the user.id is null
angular.module('scases').controller('PerfilCtrl', PerfilCtrl);
PerfilCtrl.$inject = ['$scope', 'UserFactory', '$stateParams'];
function PerfilCtrl($scope, UserFactory, $stateParams) {
$scope.id = $stateParams.userId;
My real question is: Where will I get the logged in user id, if when I soon, only comes the email?
Preserve the user in a service or Factory, and from your controllers check if the service has any registered user or not.
– OnoSendai