javascript - In angular, generate dynamic html content with ng-repeat -


my question generating dynamic html content ng-repeat contains multiple ng-model instances stored in array.

but syntax error {{ in ng-model.

is possible somehow?

<div class="col-xs-12 col-md-12 col-sm-12 col-lg-12" ng-repeat="(key, antecedente) in antecedentes" >         <div class="form-group">     <label class="col-md-3">{{antecedente.name}}</label>         <div class="col-md-1"> si&nbsp;<input ng-model="historia.antecedentes[{{key}}].seleccionado" type="radio" value="s"></div>         <div class="col-md-1"> no&nbsp;<input ng-model="historia.antecedentes[{{key}}].seleccionado" type="radio" value="n"></div>         <div class="col-md-2">observaciones </div>         <div class="col-md-5"><input ng-model="historia.antecedentes[{{key}}].observacion" class="form-control"  type="text" value=""></div>     </div> </div> 

you dont need curly braces around key, ng-model evaluates expression/variable itself

 ng-model="historia.antecedentes[key].seleccionado" 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -