javascript - Grid filtering pass result to function -


on page fiddle have grid.

in $scope.myitems have data.

i want observe data. after type in name field "enos", want records contain string ("enos").

the grid works, want print data using console log, because after filtering data want pass data function.

i tried use $scope.watch it's not working.

      .module('myapp', ['trnggrid'])     .controller("mainctrl", ["$scope", function ($scope) {         $scope.myitems = [{name: "moroni", age: 50},                  {name: "tiancum", age: 43},                  {name: "jacob", age: 27},                  {name: "nephi", age: 29},                  {name: "enos", age: 99}];          $scope.$watch('myitems', function(newvalue) {        console.log(newvalue);   });         }]);  

when type sth field console log isn't working.

answer can found documentation http://moonstorm.github.io/trnggrid/release/#/globaloptions

<table tr-ng-grid items="myitems" filtered-items="myfiltereditems"></table>  $scope.myfiltereditems = []; $scope.$watchcollection('myfiltereditems', function(items){   console.log(angular.tojson(items)); }); 

Comments

Popular posts from this blog

angularjs - Redirect to a new template in angular js -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

Desktop Launcher for Python Script Starts Program in Wrong Path (Linux) -