Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html ng-app='exampleApp'>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>TP</title>
  6.  
  7. <link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
  8. <link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap-theme.css">
  9.  
  10. <script src="../node_modules/angular/angular.js" charset="utf-8"></script>
  11.  
  12. <script type="text/javascript" src="js/app.js"></script>
  13.  
  14. </head>
  15. <body>
  16. <div class="container">
  17. <div class="row">
  18. <div class="col-md-12" ng-controller="todoCtrl as ctrl">
  19. todo : {{(ctrl.todos|filter:{done:false}).length}}
  20. <table class="table" >
  21. <tr>
  22. <th>Name</th>
  23. <th>done</th>
  24. </tr>
  25.  
  26. <tr ng-repeat="todo in ctrl.todos">
  27. <td>{{todo.name}}</td>
  28. <td>{{todo.done}}</td>
  29. </tr>
  30. </table>
  31. </div>
  32. </div>
  33.  
  34. </div>
  35.  
  36. </body>
  37. </html>
  38.  
  39.  
  40.  
  41.  
  42.  
  43. var app = angular.module('exampleApp',[]);
  44.  
  45. var todos = [
  46. {"name":"Todo 1","done":false},
  47. {"name":"Todo 2","done":true},
  48. {"name":"Todo 3","done":true},
  49. {"name":"Todo 4","done":false},
  50. {"name":"Todo 5","done":true},
  51. {"name":"Todo 6","done":false},
  52. {"name":"Todo 7","done":true},
  53. {"name":"Todo 8","done":false},
  54. {"name":"Todo 9","done":true}
  55. ];
  56.  
  57. app.value("todos",todos);
  58.  
  59. app.controller('todoCtrl',function(todos){
  60. this.todos = todos;
  61. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement