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.
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...
Firstly use ng-model
for binding. Second, use $index
as array subscript for your ng-model
ng-model="input[$index]"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.