I've got no HTML output but when I console.log the result of my $http.get I've got the object I want to have. Can someone explain me how to get the data from $http.get in my template?
.state('secure/contacts',{
url:'/secure/contacts',
template:"Contacts: {{contacts | json}}",
resolve:{
contacts : function(UserService){
return UserService.all();
}
},
controller:function($scope,contacts){
$scope.contacts = contacts;
}
})
.service('UserService',function($http){
return {
get:get,
all:all
} ;
function all(){
$http.get('/api/contacts').then(function(payload){
console.log(payload.data);
return payload.data;
});
}
function get(id){
return $http.get('/api/user/'+id).then(function(payload){
return payload.data;
});
}
});