"myData" in the code below is a json object which I extract from $http.get response (I call the request when my web app is initialised). User has to be able to change the data, so I created the code below with inputs that are filled with values in this object.
<div ng-repeat="(parameter,value) in myData">
<p>{{parameter}}</p>
<!-- show only if val is defined (not 0 or null) -->
<div ng-repeat="(par,val) in value" ng-show="val">
<p>{{par}} : <input type="text" value={{val}}></p> <!-- val is the value the user can change, and par is the parameter name such as in { parameter: "value" } -->
</div>
</div>
I created the button that the user can click when he wants to save the changed data (ng-onclick="saveData()").
saveData function could then use $http.put(url,data) to update the data somewhere…
What I don't know is how to pass the whole object to the saveData() function ? I know you can pass everything just by adding it like saveData(myVariableOrObject), but I don't see how I would do that in my case.
Probably I am missing something here, since I am fairly new with angularJS. Should my html inputs have some kind of ng-model there that would connect values to controller somehow? I would probably figure this out, but with the whole object, hm ? Would I need to construct the object in a controller function again or is there an easier approach?
If anyone can point me in the right direction I would be glad.
If I was unclear please ask for more info.
Thank you!