I have a form that lives inside an ng-repeat
. I'm not using ng-model
on the form because I don't think there is a need just yet (it's not an AJAX form). I want to set the default value of one of my text input fields to the value of j.some_attribute
, where j
is the current iteration of ng-repeat
. I've tried value="{{j.some_attribute}}"
and ng-value="j.some_attribute"
, but neither one works. When the form is submitted, the value for that field is blank. Is there a way to set the default value of a text input without creating a form model on the scope?
Dismiss
Announcing Stack Overflow Documentation
We started with Q&A. Technical documentation is next, and we need your help.
Whether you're a beginner or an experienced developer, you can contribute.
|
|||
<input value>
or<input ng-value>
or<input value="j.some_attribute>
, depending on if I use value or ng-value and if I enclose the variable in handlebars – ACIDSTEALTH Aug 4 '15 at 20:18ng-model
anyway. It will bind to the value property of the element. That being said ifng-value
not working it sounds like you have a scope issue. Is element inside a directive? Is it a hidden element? Create demo that replicates the problem – charlietfl Aug 4 '15 at 20:22name
on element? noname
means no submit – charlietfl Aug 4 '15 at 20:27name
not being specified for the inputs, not was it a scope issue. The form was not inside a directive. I couldn't solve the problem the way I'd hoped, so I refactored the form to use ng-model. – ACIDSTEALTH Aug 5 '15 at 17:34