I have a service that is used to share data between 2 controllers and retrieves a data list:
myApp.service('DataService', function($http) {
this.data = [];
this.loadData = function() {
$http.get('/api/data').success(function(data) {
this.data= data;
})
};
});
which is called in my controller:
myApp.controller('appController', function($scope, DataService) {
$scope.DataService= DataService;
DataService.loadData();
});
and displayed here:
<div ng-controller="appController">
<li ng-repeat='item in DataService.data'>
<a href="#item/{{item.ID}}"> View Item</a>
</li>
</div>
When this is ran, it doesn't display anything. I have ran it with some alert boxes and can see that the data list is populated with the data I want to display but no information is displayed otherwise.