I am trying to pull json data from the angular service but its always printing blank spaces, can some one help me please. No errors in the console as well.
Service
app.service("Java4sService", function() {
var details = {};
this.details = function() {
[{
name: "James",
country: "United Stages"
}, {
name: "Rose",
country: "United Kingdom"
}, {
name: "Smith",
country: "United States"
}]
};
this.getDetails = function() {
return details;
};
});
Controller
app.controller("Java4sController",function($scope,Java4sService){
$scope.personDetails = Java4sService.getDetails();
});
Html
<ul>
<li ng-repeat="person in personDetails ">
{{person.name}} - {{person.country}}
</li>
</ul>