Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. <html ng-app="notesApp">
  2. <head><title>Notes App</title></head>
  3. <body ng-controller="MainCtrl as ctrl">
  4. <div>
  5. <h2>Job Inspections?</h2>
  6.  
  7.  
  8. <div class="input-group">
  9. <label>Inspection ID</label>
  10. <input type="text" ng-model="ctrl.list.id">
  11. </div>
  12. <div class="input-group">
  13. <label>Inspection ID2</label>
  14. <input type="text" ng-bind="ctrl.list.id">
  15. </div>
  16. <div class=
  17. <div class="input-group">
  18. <label>Job ID</label>
  19. <input type="text" ng-model="ctrl.list.job_id">
  20. </div>
  21. <div class="input-group">
  22. <label>Inspection Type</label>
  23. <input type="text" ng-model="ctrl.inspection_type">
  24. </div>
  25. <div class="input-group">
  26. <label>Bodywork</label>
  27. <input type="checkbox"
  28. ng-checked="ctrl.bodywork === 1">
  29. </div>
  30. <div class="input-group">
  31. <label>Lighting</label>
  32. <input type="checkbox"
  33. ng-checked="ctrl.lighting === 'YES'">
  34. </div>
  35.  
  36. </div>
  37.  
  38. <script
  39. src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.js">
  40. </script>
  41. <script type="text/javascript">
  42. angular.module('notesApp', [])
  43. .controller('MainCtrl', ['ItemService', function(ItemService) {
  44. var self = this;
  45. self.list = function() {
  46. return ItemService.list().then(function(data) {
  47.  
  48. console.log(data);
  49. return data;
  50. })
  51. }();
  52.  
  53. //console.log(self.list);
  54. self.add = function() {
  55. ItemService.add({
  56. id: self.list().length + 1,
  57. label: 'Item ' + self.list().length
  58. });
  59. };
  60.  
  61. }])
  62. .factory('ItemService', ['$http', function($http) {
  63.  
  64.  
  65.  
  66.  
  67. return {
  68. list: function() {
  69.  
  70. return $http.get('/api_job_inspections/1/edit').then(function(response) {
  71. return response.data;
  72. }, function(errResponse) {
  73. console.error('Error while fetching notes');
  74. });
  75.  
  76. },
  77. add: function(item) {
  78. self.items.push(item);
  79. }
  80. };
  81.  
  82. }]);
  83.  
  84. </script>
  85. </body>
  86. </html>
  87.  
  88. return ItemService.list().then(function(data) {
  89. self.list = data;
  90. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement