smart-table Angular module unable to sort
Asked Answered
M

2

2

I am unable to do a simple sort for my Smart Table Angular module. Shouldn't I just be able to add st-sort="propertyName" to my 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>

If you click the Colors th, nothing happens and the data does not sort. What am I missing? Live demo here: http://jsbin.com/ganine/2/edit

Medick answered 27/2, 2015 at 19:22 Comment(0)
S
8

You should add a smart-table module dependency to you app module like this:

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

See working example.

Soto answered 27/2, 2015 at 19:32 Comment(0)
V
3

You need to load the smart-table script and add the 'smart-table' module reference to your app module definition.

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

You can see my changes in jsbin - http://jsbin.com/bunokerife/3/edit

Voice answered 27/2, 2015 at 20:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.