javascript - Angular JS ng-table errors TypeError: newParams reload is not a function and 10 digest iterations reached, ABort -


i using open source angular js theme sb admin completed lot of work on this. want add angular js ng-table throwing me following erros:

typeerror: a.reload not function     @ object.fn (ng-table.min.js:3)     @ h.$digest (angular.min.js:106)     @ h.$apply (angular.min.js:109)     @ f (angular.min.js:71)     @ f (angular.min.js:75)     @ xmlhttprequest.x.onreadystatechange (angular.min.js:76) 

error: [$rootscope:infdig] http://errors.angularjs.org/1.2.16/$rootscope/infdig?p0=10&p1=%5b%5b%22fn%3…c%22%3a%5b%5d%7d%3b%20oldval%3a%20%7b%5c%22data

edit:: theme code big, created small fiddle script required things, getting above , also, "newparams.reload not function , 10 $digest() iterations reached. aborting!" errors.

please check fiddle . table seems important project, advise helpful.

as searched lot 2 days find solution problem in many forums, unable find , few people, came along sort out.

any way, finded out actual problem simple, "when using ngtableparams, please didnot use 'ngtableparams' variable scope variable, try use class variable".

i didn’t know reason, why have use class variable. point of view (my conclusion based on errors), scope variables in angular js exposed watchers , go digest cycle, giving problem.

following example works awesome :

<!doctype html> <html>     <meta charset="utf-8">     <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1">     <meta name="viewport" content="width=device-width">     <link rel="stylesheet" href="./dist/bootstrap.min.css">     <link rel="stylesheet" href="./dist/bootstrap-theme.min.css">     <!--[if lt ie 9]>     <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>     <![endif]-->     <script src="./dist/angular.js"></script>     <script src="./dist/ng-table.js"></script>     <link rel="stylesheet" href="./dist/ng-table.css"> <body ng-app="main">  <div ng-controller="democtrl demo">     <table ng-table="demo.tableparams" class="table" export-csv="csv" ng-table-columns-binding="demo.columns">         <tr ng-repeat="user in $data">             <td data-title="'name'" ng-if="true">                 {{user.name}}             </td>             <td data-title="'age'" ng-if="true" filter="{ age: 'text'}">                 {{user.age}}             </td>         </tr>     </table> <!--    <table ng-table="demo.tableparams" class="table" show-filter="true">         <tr ng-repeat="user in $data">             <td title="'name'" filter="{ name: 'text'}" sortable="'name'">                 {{user.name}}</td>             <td title="'age'" filter="{ age: 'number'}" sortable="'age'">                 {{user.age}}</td>         </tr>     </table>  --></div> <script>     var app = angular.module('main', ['ngtable']).         controller('democtrl', function($scope, ngtableparams ) {             var self = this;             $scope.data = [{name: "moroni", age: 50},                 {name: "tiancum", age: 43},                 {name: "jacob", age: 27},                 {name: "nephi", age: 29},                 {name: "enos", age: 34},                 {name: "tiancum", age: 43},                 {name: "jacob", age: 27},                 {name: "nephi", age: 29},                 {name: "enos", age: 34},                 {name: "tiancum", age: 43},                 {name: "jacob", age: 27},                 {name: "nephi", age: 29},                 {name: "enos", age: 34},                 {name: "tiancum", age: 43},                 {name: "jacob", age: 27},                 {name: "nephi", age: 29},                 {name: "enos", age: 34}];          self.tableparams = new ngtableparams({             }, {                 dataset: $scope.data             });       });  </script> </body> </html> 

Comments

Popular posts from this blog

c# - Can I intercept a SOAP response in .NET before a content type binding mismatch ProtocolException? -

python - Terminate a gnome-terminal opened with subprocess -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -