I have a combobox in my view and I want to get the value of it and print it on the screen somewhere else, I'm just able to print the index of the selected item, can anyone 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();