Two on-change in a select

0

Good morning, I have the following html code:

      <select class="form-control" formControlName="tipoped" on-change="PesquisaPrazo('prazo', this.digitacaoForm)" on-change="PegarCfop(this.digitacaoForm)" id="q3Id">
        <option selected>Selecione...</option>
        <option *ngFor="let tipo of tipoped" value="{{tipo.Codigo}}">{{tipo.Codigo}} - {{tipo.Nome}}</option>
      </select>

But only the first on-change function is called (SearchPrazo), the second one is not triggered. Is there any way to use two on-change in the same select or some way to call two functions in the select?

    
asked by anonymous 21.08.2018 / 15:22

1 answer

2

You can call two functions like this:

<select class="form-control" formControlName="tipoped" on-change="PesquisaPrazo('prazo', this.digitacaoForm); PegarCfop(this.digitacaoForm);" id="q3Id">
   <option selected>Selecione...</option>
   <option *ngFor="let tipo of tipoped" value="{{tipo.Codigo}}">{{tipo.Codigo}} - {{tipo.Nome}}</option>
</select>

But I think the best way would be to call a function only and call it the ones you need, for example:

function OnChange() {
    PesquisaPrazo();
    PegarCfop();
}
    
21.08.2018 / 15:25