0
I have a combobox in my view and want to take the value of it and print on the screen somewhere else, I am managing to print only the index of the selected item, will someone help me?
HTML:
<div class="form-group">
<label>Departamento</label>
<span style="color: red;">*</span>
<select ng-model="orientador.value"
class="form-control"
ng-required="true">
<option value="">Selecione o departamento:</option>
<option ng-repeat="option in lista_departamento.availableOptions" value="{{option.id}}">{{option.name}}</option>
</select>
</div>
{{orientador.value}}
JS:
$scope.lista_departamento = {
availableOptions: [],
model: null
};
//---------------------------------------get Lista Departamneto
var getListaDepartamento = function () {
$http.get("get_departamento").then(function (resposta) {
var departamento = [];
for (var i in resposta.data){
departamento.push({id: resposta.data[i].cod_departamento, name: resposta.data[i].nome});
}
$scope.lista_departamento.availableOptions = departamento;
});
};
getListaDepartamento();