1
My question is the following. First I perform a search and fill my first select with ng-repeat. So far so good, but I perform another search for a second select that depends on this my first search. How do I get the value of that first ng-repeat?
Follows my codes
<div ng-controller="ctrSecretariaPrograma">
<label>Programa:<b><span style="color: red;">*</span></b></label></br>
<select required ng-model="lista_programa_pos.model" class="form-control">
<option value="">Selecione o Programa</option>
<option ng-repeat="option in lista_programa_pos.availableOptions" value="{{option.cod_programa}}">{{option.nome_programa}}</option>
</select>
<label></br>Curso:<b><span style="color: red;">*</span></b></label></br>
<select required ng-model="lista_curso.model" class="form-control">
<option value="">Selecione o Curso</option>
<option ng-repeat="option in lista_curso.availableOptions" value="{{option.cod_curso}}">{{option.nome_curso}}</option>
</select>
</div>
I need the value of the first select to perform the search in the second, follow my code js
$scope.lista_programa_pos = {
model: null,
availableOptions: null
};
$scope.lista_curso = {
model: null,
availableOptions: null
};
var getProgramaPos = function () {
$http.get("getProgramaPos").then(function (resposta) {
$scope.lista_programa_pos.availableOptions = resposta.data;
});
}; getProgramaPos();
var getCurso = function(option.cod_programa){
var data = {
cod_programa: option.cod_programa
};
$http.get("getCurso", data).then(function(resposta){
$scope.lista_curso.availableOptions = resposta.data;
});
}; getCurso(option.cod_programa);
I don’t know if I’m calling a certain function, because one depends on the other and I also don’t know how to get this value in the getCurso part (option.cod_programa), where would be the code I keep in my first ng-repeat