0

我尝试在“智能表”,以显示我的数据,我用Restangular和数据加载到表很不错,但(查询后在表中没有数据)搜索不工作,我新的角(和网上太大声笑),目前我真的不知道如何解决它。以下是我的代码和来自示例的代码(正确工作)。 我会非常感谢您的建议。智能表表格检索不能正常工作

我的代码(搜索不工作):

'use strict'; 

angular.module('NewApp') 
    .controller('ItemsCtrl', function ($scope, Item) { 
     $scope.items = Item.getList().$object; 
    }); 

从app.js '项目':

.... 
.factory('Item', function(ItemRestangular) { 
    return ItemRestangular.service('item'); 
    }); 

代码从例子(搜索工作正确):

'use strict'; 
angular.module('NewApp') 
    .controller('ItemsCtrl', function ($scope) { 
    $scope.items = [ 
     {firstName: 'Laurent', lastName: 'Renard', birthDate: new Date('1987-05-21'), balance: 102, email: '[email protected]'}, 
     {firstName: 'Blandine', lastName: 'Faivre', birthDate: new Date('1987-04-25'), balance: -2323.22, email: '[email protected]'}, 
     {firstName: 'Francoise', lastName: 'Frere', birthDate: new Date('1955-08-27'), balance: 42343, email: '[email protected]'} 
    ]; 
    }); 

html页面:

 ... 
     <tr ng-repeat="item in items"> 
      <td>{{item.firstName | uppercase}}</td> 
      ... 

回答

0

如果您张贴在HTML总智能表的一部分,我可以更有效地帮助你。 如果你想在智能表使用搜索功能,

你需要参考类似这样的智能表模块。

angular.module('NewApp', ['smart-table']); 

而您应该在st-table指令下的输入标记中使用st-search指令。 请确认。

<table st-table...> 
<tr> 
    <th> 
    <input st-search="" .../> 
    </th> 
</tr> 

感谢。