I am trying to create a from using json file. So I have a json file I am calling it into my html using angular js I am getting problem when I click on save button which is using ng-click , Here I am trying to use the array of user like this:
<div ng-repeat="x in myWelcome.definition.attributes">
<div ng-repeat= "y in x.children ">
<div ng-if ="y.rm_type_name == 'DV_TEXT'">
<input type="{{ y.node_id }}" name="{{ y.node_id }}" ng-model="user[y.node_id]">
</div>
<div ng-if ="y.rm_type_name == 'DV_CODED_TEXT'">
<input type="{{ y.node_id }}" name="{{ y.node_id }}" ng-model="user[y.node_id]">
</div>
</div>
<h1>You entered: {{user}}</h1>
</div>
<input type="submit" ng-click="update(user)" value="Save" />
And my controller is looking like this :
$scope.update = function(user) {
console.log(user);
};
I am getting the undefined in my console here is the plunker : https://plnkr.co/edit/62g4YhkowQtwkyBOPKi5?p=preview