I am trying to display data set using, ng-table. but data is not loading. please check my sample service and controller
app.service('ContactService', function () {
var bfLosses = [
{ idx: 0, uid: 'User 11', name: 'Name 11', area: 'Area 1'},
{ idx: 1, uid: 'User 12', name: 'Name 12', area: 'Area 1'},
{ idx: 2, uid: 'User 21', name: 'Name 21', area: 'Area 2'},
{ idx: 3, uid: 'User 22', name: 'Name 22', area: 'Area 2'}
];
}
i need to access above array to populate table. my controller
app.controller("businessController", function ($scope,NgTableParams,ContactService){
$scope.tableParams = new NgTableParams({
group: "area"
},{
dataset: $scope.bfLosses
});
});
when define array inside the controller , working well. but my requirement is accessing it inside the controller.
Service should return reference:
Service should be accessed by the dependency you injected: