convert Array to object Angularjs -


I have an array like var names [["value", "quality", "service"] , "Name": "quality", "value" 3 "}, and the" value "," value "," value "," value "," value " {"Name": "service", "value": "3.4"}] . Each and every time the array values ​​are different. ng-repeat like

  & lt; Div ng-repeat = "n names" & gt; You need to create an input field with that value using I & lt; Input name = "rating" ng-model = "n" value = "0" /> & Lt; / Div & gt;  

How can I get the prices when I submit a form to the user? Nobody can help me.

Update

I need this type of JSON :::

names = [{"name" : "Value": "value": "value": "value", "value": "3"}, {"name": "service", "value": "3.4"}]

Announce model object < / P>

$ scope.item = {};

Then just do it

  & lt; Div ng-repeat = "names in n" & gt; & Lt; Input name = "rating" ng-model = "item [n]" value = "0" /> & Lt; / Div & gt;  

The data will be collected in the items object.

Update : To get into such a model, we have to make it before compelling us to see it. Assume that all items of the controller are:

var items = names.map (function (name) {return {name: name, value: null}; })

This creates an array of expected formats for you.

Now tied this scene:

   & Lt; / Div & gt;  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -