I have an array like var names=["price","quality","service"]
, I have to convert that array to object like names=[{"name":"price", "value":"1.3"},{"name":"quality","value":"3"},{"name":"service","value":"3.4"}]
. Each and every time array values are different. I need to do build the input field with that values by using ng-repeat
like
<div ng-repeat="n in names">
<input name="rating" ng-model="n" value="0"/>
</div>
How I can fetch the values as objects when user submits the form. can any one help me.
Update
I need json as like this:::
names=[{"name":"price", "value":"1.3"},{"name":"quality","value":"3"},{"name":"service","value":"3.4"}]
ThanQ!