I have locally stored a json file, im working with it but i cannot save it, loosing persistance. This code is in my web controller (angularjs)
$http.get("users.json")
.then(function(res) {
$scope.users = res.data;
});
$scope.addUser = function() {
$scope.users.push({
name: $scope.user
});
$scope.user = "";
}
$scope.removeUser = function() {
$scope.users.pop({
name: $scope.user
});
$scope.user = "";
}
i know that another way is local storage, but i couldn't use it because i cant list every object in my html code (it says i cannot push or pop in a undefiened object).
So, how can i do it?
Thanxs!
pushto it. You can stringify data to it however quite easily and parse back to array/object while working