javascript - ng-form to submit dynamically created form without specific ng-model -


edited code ask question better
and far!
have dynamically created input boxes not have fix number of inputs , submit them go....
how pass inputs input text boxes dynamically created form?
question make sense?
form trying submit follow:
how pass values create()? passing not work... , referencing $scope.a gets 'undefined'... :(
please thank you!

<form ng-submit="create(a)">     <div class="module-head text-center">         <b class="lead">{{ module.heading }}</b>         <input class="btn" type="submit" id="submit" value="+"/>     </div>     <div class="module-body">         <div class="control-group" ng-repeat="field in module.fields">             <label class="control-label">{{field.name}}</label>             <div class="controls">                 <input type="text" name="fields"                  ng-model="a[$index]" ng-init="a[$index]=field.data">             </div>           </div>       </div> </form> 

i not sure if question, if concern access ng-model values in controller can create array line $scope.arr=[];

and in form use like

<div ng-repeat="item in items">     <input type="text" name="fields" ng-model="arr[item]"/> </div> 

in way $scope.arr have input values.

see fiddle: http://jsfiddle.net/sourabh_/hb7lu/13274/


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -