无法使用angularJS中的智能表进行排序

时间:2017-01-12 07:07:14

标签: angularjs smart-table

我正在使用智能表,但我无法对表进行排序,以下是我的代码

<div ng-app="app">
        <div ng-controller="app-controller">
            <table st-table="EmployeeDetails" class="table table-striped table-hover" st-safe-src="EmployeeData">
                <thead>
                    <tr>
                        <th st-sort="EmployeeName">Employee Name</th>                       
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="employee in EmployeeData">
                        <td class="col-xs-2">
                            <small>{{employee.EmployeeName}}</small>                           
                        </td>                        
                    </tr>                  
                </tbody>
            </table>
        </div>
    </div>
    <script type="text/javascript">
        var app = angular.module('app', []);
        app.controller('app-controller', ['$scope','$http', function ($scope,$http) {
            $http.get('/Data/EmployeeDetails.json').success(function (data) {              
                $scope.EmployeeData = data;
            }).error(function () {
                alert('error');
            });
        }]);       
    </script>

任何人都可以告诉我究竟是什么问题,我已经引用了angular.js和smart-table.js

<script src="../Scripts/angular.js"></script>
    <script src="../Scripts/smart-table.js"></script>

1 个答案:

答案 0 :(得分:1)

您应该使用&#39; EmployeeDetails&#39;在ng-repeat
JSFiddle

<tr ng-repeat="employee in EmployeeDetails">

NG

<tr ng-repeat="employee in EmployeeData">

由于

相关问题