D
D
DarthJS2015-07-14 22:46:57
Angular
DarthJS, 2015-07-14 22:46:57

How correctly in this situation to organize the transfer of information to the object?

Please tell me how to get an object of this type from the form:

info: [
{name: "название поля", value: "результат инпута"},
{name: "название поля", value: "результат инпута"}...]

For example:
<label>Name: </label><input type="text" ng-model="info.value"> // в него мы пишем например Мик
<label>Last Name: </label><input type="text" ng-model="info.value"> //а сюда Томсон

The output should be:
info: [ 
{"name": "Name: ", "value": "Мик"},
{"name": "Last Name", "value": "Томсон"}... и так далее..]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
_
_ _, 2015-07-14
@AMar4enko

ng-model="info[0].value"
ng-model="info[1].value"

D
DigitalSmile, 2015-07-15
@DigitalSmile

Create your directive with require: 'ngModel' and add your parser that can convert and pass values ​​from your inputs anywhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question