]> git.somenet.org - pub/jan/aic18.git/blob - sentiment-analysis/src/main/webapp/forms/input-terms.html
add form to input terms
[pub/jan/aic18.git] / sentiment-analysis / src / main / webapp / forms / input-terms.html
1 <form name="twitterForm" role="form">
2   <script cam-script type="text/form-script">
3     // angular form works on scope object
4     var terms = $scope.terms = [];
5
6     // scope function which adds a new term
7     $scope.addTerm = function() {
8       terms.push({});
9     };
10
11     camForm.on('form-loaded', function() {
12       // declare variable 'terms' incuding metadata for serialization
13       camForm.variableManager.createVariable({
14         name: 'terms',
15         type: 'Object',
16         value: terms,
17         valueInfo: {
18           // indicate that object is serialized as json
19           serializationDataFormat: 'application/json',
20           // provide classname of java object
21           objectTypeName: 'at.ac.tuwien.infosys.aic.serialized.model.Terms'
22         }
23       });
24
25     });
26
27   </script>
28
29   <h3>Terms</h3>
30
31   <div>
32       <a href
33          ng-click="addTerm()"
34          class="btn btn-default">Add</a>
35           <hr/>
36
37     <div ng-repeat="term in terms">
38       <div class="control-group">
39         <label class="control-label" for="name">Name</label>
40         <div class="controls">
41           <input id="name"
42                  class="form-control"
43                  type="text"
44                  required
45                  ng-model="term">
46         </div>
47       </div>
48     </div>
49   </div>
50 </form>