|
26 | 26 | popoverTemplateUrl: 'example/popoverTemplate.html' |
27 | 27 | }); |
28 | 28 | } |
29 | | - ]).controller('DemoController', function($scope, $builder, $validator) { |
30 | | - var checkbox, textbox; |
31 | | - textbox = $builder.addFormObject('default', { |
32 | | - component: 'textInput', |
33 | | - label: 'Name', |
34 | | - description: 'Your name', |
35 | | - placeholder: 'Your name', |
36 | | - required: true, |
37 | | - editable: false |
38 | | - }); |
39 | | - checkbox = $builder.addFormObject('default', { |
40 | | - component: 'checkbox', |
41 | | - label: 'Pets', |
42 | | - description: 'Do you have any pets?', |
43 | | - options: ['Dog', 'Cat'] |
44 | | - }); |
45 | | - $builder.addFormObject('default', { |
46 | | - component: 'sampleInput' |
47 | | - }); |
48 | | - $scope.form = $builder.forms['default']; |
49 | | - $scope.input = []; |
50 | | - $scope.defaultValue = {}; |
51 | | - $scope.defaultValue[textbox.id] = 'default value'; |
52 | | - $scope.defaultValue[checkbox.id] = [true, true]; |
53 | | - return $scope.submit = function() { |
54 | | - return $validator.validate($scope, 'default').success(function() { |
55 | | - return console.log('success'); |
56 | | - }).error(function() { |
57 | | - return console.log('error'); |
| 29 | + ]).controller('DemoController', [ |
| 30 | + '$scope', '$builder', '$validator', function($scope, $builder, $validator) { |
| 31 | + var checkbox, textbox; |
| 32 | + textbox = $builder.addFormObject('default', { |
| 33 | + component: 'textInput', |
| 34 | + label: 'Name', |
| 35 | + description: 'Your name', |
| 36 | + placeholder: 'Your name', |
| 37 | + required: true, |
| 38 | + editable: false |
58 | 39 | }); |
59 | | - }; |
60 | | - }); |
| 40 | + checkbox = $builder.addFormObject('default', { |
| 41 | + component: 'checkbox', |
| 42 | + label: 'Pets', |
| 43 | + description: 'Do you have any pets?', |
| 44 | + options: ['Dog', 'Cat'] |
| 45 | + }); |
| 46 | + $builder.addFormObject('default', { |
| 47 | + component: 'sampleInput' |
| 48 | + }); |
| 49 | + $scope.form = $builder.forms['default']; |
| 50 | + $scope.input = []; |
| 51 | + $scope.defaultValue = {}; |
| 52 | + $scope.defaultValue[textbox.id] = 'default value'; |
| 53 | + $scope.defaultValue[checkbox.id] = [true, true]; |
| 54 | + return $scope.submit = function() { |
| 55 | + return $validator.validate($scope, 'default').success(function() { |
| 56 | + return console.log('success'); |
| 57 | + }).error(function() { |
| 58 | + return console.log('error'); |
| 59 | + }); |
| 60 | + }; |
| 61 | + } |
| 62 | + ]); |
61 | 63 |
|
62 | 64 | }).call(this); |
0 commit comments