index.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!DOCTYPE html>
  2. <html lang="en" ng-app="fea5">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>ANGULAr</title>
  6. <link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css">
  7. </head>
  8. <body>
  9. <div class="container" ng-controller="Main">
  10. <div class="page-header">
  11. <h1>Hello</h1>
  12. </div>
  13. <h2 ng-show="x>y">Go Home 1</h2>
  14. <h2 ng-hide="x>y">Go Home 2</h2>
  15. <h3 ng-if="true">asdfasdad</h3>
  16. <div ng-switch="color">
  17. <div ng-switch-when="red">aaaa</div>
  18. <div ng-switch-when="blue">aaaa</div>
  19. <div ng-switch-when="green">aaaa</div>
  20. <div ng-switch-when="black">aaaa</div>
  21. <div ng-switch-default="purple">aaaa</div>
  22. </div>
  23. <input type="number" ng-model="value"> + 1 = {{1+value}}
  24. <input type="number" ng-model="x"><button ng-click="sum()">+</button><input type="number" ng-model="y"> {{result}}
  25. <input type="text" ng-model="item">
  26. <button class="btn btn-primary" ng-click="addItem()">+</button>
  27. <ul>
  28. <li ng-repeat="item in data track by $index">{{item}} <button class="btn btn-danger" ng-click="deleteItem($index)">x</button></li>
  29. </ul>
  30. <div>
  31. <div class="col-md-6">
  32. <div>Shape Maker</div>
  33. <span>Width</span><input type="number" ng-model="style.width""><br />
  34. <span>Height</span><input type="number" ng-model="style.height" ><br />
  35. <span>Background</span><input type="text" ng-model="style.background" >
  36. </div>
  37. <div class="col-md-6">
  38. <div ng-style="{width: style.width+'px', height: style.height+'px', background: style.background}"></div>
  39. </div>
  40. </div>
  41. </div>
  42. <div ng-controller="BooksList">
  43. <div class="page-header"><h1>Books List</h1></div>
  44. <div>
  45. <input ng-model="searchString" placeholder="sortFieldlter">
  46. </div>
  47. <table class="table table-striped">
  48. <thead>
  49. <tr>
  50. <th ng-click="sortBy('title')"><i class="glyphicon" ng-class="{'glyphicon-chevron-up': sortField === 'title', 'glyphicon-chevron-down': sortField === '-title'}">TITLE</th>
  51. <th ng-click="sortBy('author')"><i class="glyphicon" ng-class="{'glyphicon-chevron-up': sortField === 'author', 'glyphicon-chevron-down': sortField === '-author'}"></i>Author</th>
  52. <th ng-click="sortBy('date')">Date</th>
  53. <th ng-click="sortBy('cost')">Cost</th>
  54. <th ng-click="sortBy('rate')">Rate</th>
  55. </tr>
  56. </thead>
  57. <tr ng-repeat="item in books | orderBy: sortField |filter: searchString track by $index ">
  58. <td>{{item.title}}</td>
  59. <td>{{item.author | uppercase}}</td>
  60. <td>{{item.date | date: 'longDate'}}</td>
  61. <td>{{item.cost | currency}}</td>
  62. <td>{{item.rate | number : 1}}</td>
  63. <td><button class="btn btn-danger" ng-click="deleteBook(item.id)">x</button></td>
  64. </tr>
  65. </table>
  66. <div class="text-center" ng-if="!books.length">No data</div>
  67. </div>
  68. <script src="./node_modules/angular/angular.js"></script>
  69. <script src="./app/app.module.js"></script>
  70. <script src="./app/controllers/main.controller.js"></script>
  71. <script src="./app/controllers/books-list.controller.js"></script>
  72. </body>
  73. </html>