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 <input ng-model="historia.antecedentes[{{key}}].seleccionado" type="radio" value="s"></div> <div class="col-md-1"> no <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
Post a Comment