Not really sure if it is a bug or not, but it happened with me.
If you initialize a variable to receive an instance of NgTableParams as an empty object and then change its value asynchronously later, you get a TypeError saying that "newParams.reload is not a function". Despite of the table data is correctly shown (if you update the value correctly, of course), you will keep getting this error on console, which is unpleasant.
This is an example of the code:
angular.module('app').controller('Controller', Controller);
Controller.$inject = ['NgTableParams'];
function Controller(NgTableParams) {
vm = this;
vm.tableParams = {};
// ...
vm.init = function(){
someArbitraryPromise.then(function(result){
// ...
vm.tableParams = new NgTableParams(/* ... whatever in here ... */);
// ...
});
}
// ...
}
This occurs because the following lines of code in ngTable.js (lines 1042 to 1048):
When newParams is an empty object, !newParams will not work and newParams.reload() will be called with newParams being an empty object. Some better validation whether newParams is empty or not is required to fix this.
Not really sure if it is a bug or not, but it happened with me.
If you initialize a variable to receive an instance of NgTableParams as an empty object and then change its value asynchronously later, you get a TypeError saying that "newParams.reload is not a function". Despite of the table data is correctly shown (if you update the value correctly, of course), you will keep getting this error on console, which is unpleasant.
This is an example of the code:
This occurs because the following lines of code in ngTable.js (lines 1042 to 1048):
When
newParams
is an empty object,!newParams
will not work andnewParams.reload()
will be called withnewParams
being an empty object. Some better validation whethernewParams
is empty or not is required to fix this.I'm using ngTable v0.8.3 and Angular 1.5.5.