2
I’m building a CRUD complete, and when it comes time to edit, I have a problem with ng-repeat. To save, I have a form with a select and ng-repeat which contains the functions a collaborator may have (Coordinator, supervisor, teacher, etc.). So far so good, he saves in the bank everything straight, with the function id. But when editing, he fills in this form with all the information, except the select with the ng-repeat, which is "empty". I must leave select with the preselected value with the id value that comes from the bank, but I’m not getting.
This is my select with ng-repeat
<div ng-controller="funcoesController">
<div class="form-group error">
<label for="inputFuncao" class="col-sm-3 control-label"> Função </label>
<div class="col-sm-9">
<select name="funcao" ng-model="colaborador.funcao_id" ng-required="true">
<option ng-repeat="f in tbfuncao" value="{{f.id}}">
{{f.descricao}}
</option>
</select>
</div>
<span class="help-inline"
ng-show="frmColaboradores.funcao.$invalid && frmColaboradores.funcao.$touched">
Função do colaborador é obrigatória </span>
</div>
</div>
I don’t know what else to put in here, in case I need more, just ask... Thanks for your help.