Sorry I am new to Angular. And this is probably dump question. I have following data structure in a json:
[
{"id": "1", "name": "Alan", "location": "US"},
{"id": "2", "name": "Bella", "location": "UK"}
]
I have following service:
let users = getData();
function getUsers() {
return users;
}
function getData() {
return $http
.get("./data/users.json")
.then(function(response) {
return response.data;
});
}
function addUser(user) {
let id = users.$$state.value[users.$$state.value.length - 1].id++;
users.$$state.value.push({
// adding user
})
}
I am obtaining some very inconvenient object from $http.get
. How to get it back to array representation?