1
I have a very strange problem. I have some filters that are like this.
<div ng-show="filtroReduzido" class="col-md-2">
<div class="form-group">
<label>Codigo Reduzido</label>
<div class="form-group form-md-line-input no-hint right" style="padding-top: 3px;">
<select id="servico"
name="servico"
chosen
width="150"
allow-single-deselect="true"
ng-model="vm.filtro.des_servico"
style="width:100%"
ng-options="clienteFiltro as cliente.Des_Servico for cliente in vm.importacaoSiltDet |unique:'Des_Servico'| orderBy:'Des_Servico'"></select>
</div>
</div>
</div>
In the controller I declare the "filter"
vm.filtro = {};
In my Function I call this ng-model
but she comes undifined
.
dateDe and dateAte are receiving the parameters normally, and the vm.relatorio
is declared equal vm.filtro
.
I don’t understand why the variables test2
and test3
are coming undifined
, am I missing a step? maybe give a bind in the values of the filter parameters?
vm.filtrarDetFiltrado = function () {
debugger;
var dateDe = formatarData(vm.relatorio.dataDe);
var dateAte = formatarData(vm.relatorio.dataAte);
var test2 = vm.filtro.des_servico;
var test3 = vm.filtro.Des_Servico;
Initially try to declare a value for this variable, so:
vm.filtro = { des_servico: null };
– Douglas Garrido
It declared thus getting des_servico:Undefined but in var teste3 it does not receive the filter parameter.
– Vinicius Cano
Take a look at the first example of Angular documentation.. Angularjs - Select, see if it helps you
– Douglas Garrido
I think I found the problem, I was in ng-options,I switched to ng-options="client.Des_servico for client in vm.importacaoSiltDet however now instead of passing the filter value this passing the grid object.
– Vinicius Cano
I just started this and it worked ng-options="client.Des_servico as client.Des_servico for client in vm.importacaoSiltDet
– Vinicius Cano
@Viniciuscano you can make an answer to your own post, to help future people with the same doubt
– andrepaulo