1
Person have an input from type="radio"
when clicked calls a function and fills a select.. but this only happens when I click the input.. I need it to load automatically on the page loading, I have the following code:
<label class="margin-10-right">
<input data-ng-click="vm.getFinanceiroTipoReceita(); vm.despesa.TipoSaida = false; vm.despesa.TipoEntrada = true"
data-ng-checked="!vm.despesa.TipoEntrada"
data-ng-value="true"
data-ng-model="vm.despesa.TipoEntrada"
name="tipo"
type="radio">
Entrada (Receita)
</label>
function getFinanceiroTipoReceita() {
vm.listaArray = [];
$.each(vm.listaTipoDespesa, function (indice, obj) {
if (obj.TipoEntrada == true) {
vm.listaArray.push(obj);
// console.log(vm.listaArray);
}
});
}
Add the code of your
controller
.– Sorack
Ready already added
– wDrik
You want to fill the
select
in accordance with theradio
that was marked, that?– Sorack
It already happens, but only when I click on
radio
.. I need you to do this when the page is loaded and the radio is already checked as default...– wDrik
Just you assign on
JS
the value in the variable related tong-model
and call the function that is in theng-click
.– Sorack
Has any response helped solve the problem and can address similar questions from other users? If yes, do not forget to mark the answer as accepted. To do this just click on the left side of it (below the).
– Sorack