Can I use the entered value via ng-model to fill the angular ng grid?

This plunker correctly populates a static HTML table based on the search for "Tim" (Json Data).

    var arrItem = [];
    angular.forEach($scope.items, function (item) {
    if(item.fname === enteredValue.firstName || item.lname === enteredValue.lastName
    ||item.address === enteredValue.address && item.phone === enteredValue.phone){
        arrItem.push({
            first: item.fname,
            last: item.lname,
            address: item.address,
            phone: item.phone

        });

      

Now I want to put this data into NG-Grid.
This plunker tries to load this data into the NG grid based on a search by tim. I have tried so many ways to do this. Now I am trying to assign arrItem to $ scope.source and pass it to getPagedDataAsync. Any ideas?

  $scope.source= arrItem;
  $scope.getPagedDataAsync($scope.source, $scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage); 

      

0


source to share


1 answer


In the controller where you define gridOptions you are using the wrong scope variable name.

 data: 'myData',

      



it should be

 data: 'source',

      

0


source







All Articles