mrsus
mrsus

Reputation: 5486

AngularJS: getting values from nested ng-repeat form

I am new to AngularJS, I successfully designed the repeated forms using nested ng-repeat. But I can't find the right way to get all values corresponding to the forms.

Here is my updated JSFiddle: http://jsfiddle.net/MrSuS/gTc5v/7/

Update: And you can see, radio input is also not working properly.

Upvotes: 1

Views: 991

Answers (2)

Poyraz Yilmaz
Poyraz Yilmaz

Reputation: 5857

there is no binding in your application use ng-model to bind your field values.

if you want to design custom form depends on your dynamic data you should write a directive like this Example Form Directive

UPDATE

I think best way is repeat html form in your position. It is simple, easy and less code...

<div ng-repeat="form in forms">
    <h2>{{form.name}}</h2>
    <input type="text" ng-model="form.answer.city"><br/>
    ...

here is JSFIDDLE example...

Upvotes: 2

harishr
harishr

Reputation: 18055

Firstly use ng-model for binding. Second, use $index as array subscript for your ng-model

 ng-model="input[$index]"

Upvotes: 1

Related Questions