You can use Php session and return it to Angular service. Then you can share your user information with service to other controllers.
I recommend you to use ngRoute and shared service which contains user information. This method is very fast and secure.
I just edit my answer and made a quick example for you.
var doc = angular.module('doc',
[
'ngRoute'
]);
doc.service('link', function () {//Creating my service
this.user = false;//Here is my user object. I am changing these datas in the login section.
});
doc.config(function($routeProvider, $locationProvider) {
$routeProvider
.when('/homepage', {
templateUrl: 'view/homepage.html',
controller: 'homePage',
})
.when('/login', {
templateUrl: 'view/login.html',
controller: 'login',
})
$locationProvider.html5Mode(true);
});
doc.controller("login", function ($scope, $timeout, link, $location) { //As you see I sent 'link' as a parameter. So I can easily use my service and the user data.
$scope.username = "";
$scope.password = "";
$scope.login = function () {
$.get("/login.php", {username:$scope.username,password:$scope.password},function(data){
if(data){
link.user = JSON.parse(data); // I am parsing my json data and save to link.user
$location.path("/homapage");
}
});
}
});
doc.controller("homePage", function ($scope, $timeout, link, $location) { //As you see I sent 'link' as a parameter. So I can easily use my service and the user data.
if(link.user){
console.log(link.user); // I can access my user!
}else{
$location.path("/login");
}
});
As you see my service contains my user datas which I initialized at the login page. Now I am using them in my controllers easily.