【问题标题】:smart-table Angular module unable to sort智能表 Angular 模块无法排序
【发布时间】:2015-02-27 19:22:24
【问题描述】:

我无法对我的Smart Table Angular module 进行简单排序。我不应该可以将st-sort="propertyName" 添加到我的th 吗?

JS:

var app = angular.module('app', []);

app.controller('SomeController', ['$scope', function($scope) {
  $scope.items = [{color:'red'},{color:'blue'}];
}]);

HTML:

<html ng-app="app"><body ng-controller="SomeController">
  <table st-table="items">
    <thead>
      <tr>
        <th st-sort="color">Color</th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="item in items">
        <td>{{item.color}}</td>
      </tr>
    </tbody>
  </table>
</body></html>

如果您单击Colorsth,则不会发生任何事情并且数据不会排序。我错过了什么?现场演示:http://jsbin.com/ganine/2/edit

【问题讨论】:

    标签: angularjs smart-table


    【解决方案1】:

    您应该像这样为您的app 模块添加一个smart-table 模块依赖项:

    var app = angular.module('app', ['smart-table']);
    

    查看工作example

    【讨论】:

      【解决方案2】:

      您需要加载智能表脚本并将'smart-table' 模块引用添加到您的app 模块定义中。

       var app = angular.module('app', ['smart-table']);
      

      你可以在jsbin中看到我的变化-http://jsbin.com/bunokerife/3/edit

      【讨论】:

        猜你喜欢
        • 2018-04-20
        • 1970-01-01
        • 1970-01-01
        • 2014-05-24
        • 1970-01-01
        • 2016-11-05
        • 1970-01-01
        • 1970-01-01
        • 2017-12-13
        相关资源
        最近更新 更多