Under the controller named usersConrtoller.js
I'm storing some object data in the localStorage
using ngStorage
.
$scope.users = [{
"entity$": "-/sys/daily_journeys",
"name": "Tom",
"walked": 90,
"traveled_distance": "773",
"total_cout": 0.367,
"days": 22,
"avg_risk": "0.0",
"risk_category": "GREEN"
}]
saved to local storage:
$localStorage.users = $scope.users;
How can I access $localStorage.users
object's data in other controllers?
As far as I know the
ngStorage
is an injectable service so in other controller you just need to inject the service and read itor you might need to watch over it to see if it's updated