$scope.$watch('result', function () {
$scope.tableParams.settings().$scope = $scope; <<--nested scope is replacing!!
$scope.tableParams.reload();
});
DirectivengTable creates a nested area that includes all the directive settings for work, so you do not replace it with the ReportController function,
you need to delete this line
$scope.tableParams.settings().$scope = $scope; >
ngTable, ,
ngTables $scope.tableParams.reload() TypeError: '$ data' null
UPDATE
ngTableParams $watch findReportData,
2
plunk, httpservice,
, getData func ngTableParams, , (, , $watch, plunk), $scope.tableParams.reload();, , . , , , ,
getData :
getData: function($defer, params) {
var selectedPeriod = $scope.reportBillingPeriod ;
if( selectedPeriod === null )
selectedPeriod = '0';
$scope.customers_report = Reports.get({
monthReport: selectedPeriod
}, function(result ){
var data = result.customers;
$scope.tableParams.total(data.length);
var orderedData = params.sorting() ? $filter('orderBy')(data, params.orderBy()) : data;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
});
}
:
$scope.reportBillingPeriod = 0;
$scope.$watch('reportBillingPeriod', function(newValue, oldValue) {
$scope.tableParams.reload();
});
3
getData func, $watch reportBillingPeriod, , , , ,
$scope.reportBillingPeriod = defaultValue;
$scope.$watch('reportBillingPeriod', function(newValue, oldValue) {
if (newValue!=oldValue)
$scope.tableParams.reload();
});