books-list.template.html 1.6 KB

12345678910111213141516171819202122232425262728
  1. <div class="container" ng-controller="BooksList">
  2. <h1>Books list</h1>
  3. <input type="text" name="book" ng-model='searchString' placeholder="Search...">
  4. <table class="table table-striped table-hover">
  5. <thead>
  6. <tr>
  7. <th scope="col">Index</th>
  8. <th scope="col" ng-click="sortBy('title')"><i class="glyphicon" ng-class="{'glyphicon-chevron-up' : sortField === 'title', 'glyphicon-chevron-down' : sortField === '-title'}"></i> Title</th>
  9. <th scope="col" ng-click="sortBy('author')"><i class="glyphicon" ng-class="{'glyphicon-chevron-up' : sortField === 'author', 'glyphicon-chevron-down' : sortField === '-author'}"></i>Author</th>
  10. <th scope="col" ng-click="sortBy('date')"><i class="glyphicon" ng-class="{'glyphicon-chevron-up' : sortField === 'date', 'glyphicon-chevron-down' : sortField === '-date'}"></i>Date</th>
  11. <th scope="col" ng-click="sortBy('cost')"><i class="glyphicon" ng-class="{'glyphicon-chevron-up' : sortField === 'cost', 'glyphicon-chevron-down' : sortField === '-cost'}"></i>Cost</th>
  12. <th scope="col" ng-click="sortBy('rate')"><i class="glyphicon" ng-class="{'glyphicon-chevron-up' : sortField === 'rate', 'glyphicon-chevron-down' : sortField === '-rate'}"></i>Rate</th>
  13. <th></th>
  14. </tr>
  15. </thead>
  16. <tbody>
  17. <tr ng-repeat="book in books | filter: searchString | orderBy: sortField track by $index">
  18. <td>{{$index}}</td>
  19. <td>{{book.title}}</td>
  20. <td>{{book.author | uppercase}}</td>
  21. <td>{{book.date | date : 'longDate'}}</td>
  22. <td>{{book.cost | currency}}</td>
  23. <td>{{book.rate | number : 1}}</td>
  24. <td><button class="btn btn-danger btn-xs" ng-click="deleteBook(book.id)">x</button></td>
  25. </tr>
  26. </tbody>
  27. </table>
  28. </div>