For some reason im losing scope of ngtable params in my view , everything in ngtableparams is undefined ( i see in angularjs batarang binding ).
my controller code is
this.contractsParams = new ngTableParams({
defaultSort: 'asc',
counts: [],
total: 10, // length of data
getData: function ($defer, params) {
this.MyService.query(
angular.bind( function (data) {
debugger;
$defer.resolve(data.Data);
}));
}
});
also , the getdata is not getting called at all ever.
My View
<table ng-table="controller.contractsParams">
<tr ng-repeat="contract in $data">
<td data-title="'Title'" data-sortable="'Title'">{{contract.Title}}</td>
</tr>
The issue of losing scope might be rooted in
ngTableParams
initialization, it takes two objects: parameters and settings , have a look in docs. So the simple initialization look like :Have look in example plunk from official site.
Resolved this by adding this piece to my view
ng-controller="myController as controller"