I want to use angular for rendering multipple forms in camunda tasklist in my case i want to read data from json file and transform it into relative form , here are several things i am interested in:
1.is it nessassary to gnerate ng-models i don’t want to add extra data to my project
2.what kind of angular support does camunda have ? i have to install angular cli inside my maven project, or
there is some more natural way to do it?
3.since all i need is redering json file data into forms is it possible to make it by simple javscript?
4.here is my code which always gives me unexpected token error?
what should i change to make my code work?
form role="form" name="responseData">
<script src="camunda-bpm-sdk-angular.js" cam-script type="text/form-script" >
var items = $scope.items = [];
camForm.on('form-loaded', function() {
// declare variable 'customerData' incuding metadata for serialization
camForm.variableManager.createVariable({
name: 'items',
type: 'Object',
value: jsonData,
valueInfo: {
// indicate that object is serialized as json
serializationDataFormat: 'application/json'
}
});
});
$url = 'C:/Users/s.tkhilaishvili/Desktop/service1/camunda-test/src/main/webapp/forms/data.json'; // path to your JSON file
$data = file_get_contents($url); // put the contents of the file into a variable
vat jsonData=JSON.parse($data);
for(var i=0;i<bject.keys(jsonData).length;i++){
var dat1=jsonData[i];
$scope.items.push({id:dat1["id"] , cardNumber:dat1["cardNumber"],organizationNameGE:dat1["organizationNameGE"],organizationNameEN:dat1["organizationNameEN"] });
}
}
</script>
<div class="form-group">
<label for="id">id</label>
<input class="form-control" ng-repeat="i in items"
cam-variable-type="Long"
cam-variable-name="id"
name="id"
ng-model=i.id/>
</div>
<div class="form-group">
<label for="organizationNameGE">name</label>
<input class="form-control" ng-repeat="i in items"
cam-variable-type="String"
cam-variable-name="Name"
name="name"
ng-model=i.name />
</div>
<script src="camunda-bpm-sdk-angular.js" cam-script type="text/form-script">
camForm.on('form-loaded', function() {
camForm.variableManager.fetchVariable('items');
});
</script>
</form>