我可以通过使用NG-模型输入值来填充角度纳克格? [英] Can I use entered value through ng-model to populate angular ng grid?

查看:143
本文介绍了我可以通过使用NG-模型输入值来填充角度纳克格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

plunker 填充静态HTML表格的基础上正确进行搜索蒂姆(JSON数据)。

  VAR arrItem = [];
    angular.forEach($ scope.items,功能(项目){
    如果(item.fname === enteredValue.firstName || item.lname === enteredValue.lastName
    || item.address === enteredValue.address&放大器;&安培; item.phone === enteredValue.phone){
        arrItem.push({
            第一:item.fname,
            最后:item.lname,
            地址:item.address,
            电话:item.phone        });

现在我要放置在NG-电网这个数据。结果
plunker 尝试加载这些数据转化为NG电网基础上添搜索。我试了很多方法来做到这一点。现在,我想arrItem分配给$ scope.source并传递到getPagedDataAsync。任何想法?

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


解决方案

在你的控制器,其中定义gridOptions,您使用的是错误的范围变量名。

 数据:myData的,

 数据:'源',

This plunker populates a static Html Table correctly based on a 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 place this data in a NG-Grid.
This plunker attempts to load this data into NG Grid based on a Tim Search. I tried so many ways to do this. Now I'm trying to assign arrItem to $scope.source and pass that into getPagedDataAsync. Any ideas?

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

解决方案

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

 data: 'myData',

should be

 data: 'source',

这篇关于我可以通过使用NG-模型输入值来填充角度纳克格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆