javascript - 智能表格无法正确排序

标签 javascript sorting angularjs-ng-repeat smart-table

我的列标题未使用智能表格正确排序。他们不是单独排序,而是一起排序。

<thead>
    <tr>
        <th st-sort="field" ng-repeat="field in stat.q">{{field}}</th>
    </tr>
</thead>

这是javascript。

stat.q = ["Who is the coolest?", "What is your favorite color?", "Pick a movie", "Where do you want to go?", "test rating"];   

最佳答案

要使用 ng-repeat,您必须将大括号放在 {{field}} 周围:

<thead>
  <tr>
    <th st-sort="{{field}}" ng-repeat="field in stat.q">{{field}}</th>
  </tr>
</thead>

关于javascript - 智能表格无法正确排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31455383/

相关文章:

javascript - Angularjs从文本框中搜索常量值+值

javascript - asp.net 中哪个函数会先执行?

javascript - 为什么 JS 不单独针对我的类?

javascript - 在 React.js 中的渲染函数之外使用循环

c - 颠倒c中的字节顺序

javascript - 将 Angular 元素绑定(bind)到 Controller 外部的范围

javascript - 使用 Express 合并、缩小和提供 JavaScript 文件,但响应未压缩

javascript - 如何解决 ng-repeat AngularJS 中的 sort() 方法?

javascript - 如何对 ES6 `Set` 进行排序?

angularjs - 您如何在指令范围内访问 ng-repeat 项的子项?