index.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE html>
  2. <html lang="en" ng-app='fea5'>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>AngularJS Silifonov</title>
  6. <link rel="stylesheet" type="text/css" href="node_modules/bootstrap/dist/css/bootstrap.min.css"/>
  7. </head>
  8. <body>
  9. <div class="container" ng-controller="BooksList">
  10. <h1>Books list</h1>
  11. <input type="text" name="book" ng-model='searchString' placeholder="Search...">
  12. <table class="table table-striped table-hover">
  13. <thead>
  14. <tr>
  15. <th scope="col">Index</th>
  16. <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>
  17. <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>
  18. <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>
  19. <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>
  20. <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>
  21. <th></th>
  22. </tr>
  23. </thead>
  24. <tbody>
  25. <tr ng-repeat="book in books | filter: searchString | orderBy: sortField track by $index">
  26. <td>{{$index}}</td>
  27. <td>{{book.title}}</td>
  28. <td>{{book.author | uppercase}}</td>
  29. <td>{{book.date | date : 'longDate'}}</td>
  30. <td>{{book.cost | currency}}</td>
  31. <td>{{book.rate | number : 1}}</td>
  32. <td><button class="btn btn-danger btn-xs" ng-click="deleteBook(book.id)">x</button></td>
  33. </tr>
  34. </tbody>
  35. </table>
  36. </div>
  37. <script src="node_modules/angular/angular.js"></script>
  38. <script src="app/app.module.js"></script>
  39. <script src="app/controllers/main.controller.js"></script>
  40. <script src="app/controllers/books-list.controller.js"></script>
  41. </body>
  42. </html>