Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html ng-app="notesApp">
- <head><title>Notes App</title></head>
- <body ng-controller="MainCtrl as ctrl">
- <div>
- <h2>Job Inspections?</h2>
- <div class="input-group">
- <label>Inspection ID</label>
- <input type="text" ng-model="ctrl.list.id">
- </div>
- <div class="input-group">
- <label>Inspection ID2</label>
- <input type="text" ng-bind="ctrl.list.id">
- </div>
- <div class=
- <div class="input-group">
- <label>Job ID</label>
- <input type="text" ng-model="ctrl.list.job_id">
- </div>
- <div class="input-group">
- <label>Inspection Type</label>
- <input type="text" ng-model="ctrl.inspection_type">
- </div>
- <div class="input-group">
- <label>Bodywork</label>
- <input type="checkbox"
- ng-checked="ctrl.bodywork === 1">
- </div>
- <div class="input-group">
- <label>Lighting</label>
- <input type="checkbox"
- ng-checked="ctrl.lighting === 'YES'">
- </div>
- </div>
- <script
- src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.js">
- </script>
- <script type="text/javascript">
- angular.module('notesApp', [])
- .controller('MainCtrl', ['ItemService', function(ItemService) {
- var self = this;
- self.list = function() {
- return ItemService.list().then(function(data) {
- console.log(data);
- return data;
- })
- }();
- //console.log(self.list);
- self.add = function() {
- ItemService.add({
- id: self.list().length + 1,
- label: 'Item ' + self.list().length
- });
- };
- }])
- .factory('ItemService', ['$http', function($http) {
- return {
- list: function() {
- return $http.get('/api_job_inspections/1/edit').then(function(response) {
- return response.data;
- }, function(errResponse) {
- console.error('Error while fetching notes');
- });
- },
- add: function(item) {
- self.items.push(item);
- }
- };
- }]);
- </script>
- </body>
- </html>
- return ItemService.list().then(function(data) {
- self.list = data;
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement