Add value in an input according to selection of an angular / ionic combobox

0

I have an input text and I need it when I choose an option in a combobox to receive this value, but without deleting what is already written.

What I've tried:

 <ion-textarea name="resposta" #resposta value="{{insercaorapidasistema}}{{respostaautomatica.value}}"

My two attempts, one with ngmodel, another with local variable.

<ion-item>
  <ion-label>Combo 1</ion-label>
  <ion-select #respostaautomatica>
    <ion-option value="opcao 1 ">Opcao 1</ion-option>
    <ion-option value="opcao 2 ">Opcao 2</ion-option>
  </ion-select>
</ion-item>

<ion-item>
  <ion-label>Combo 2</ion-label>
  <ion-select [(ngModel)]="insercaorapidasistema">
    <ion-option value="Opcao 1 ">opcao 1</ion-option>
    <ion-option value="Opcao 2 ">opcao 2</ion-option>
  </ion-select>
</ion-item>

The problem is that if I write something in the input text and then select a value from the combobox, which I write in the input some.

    
asked by anonymous 03.08.2018 / 18:47

1 answer

0

I suggest that you create another field to include the total value so that a circular reference does not occur. For example:

<div>{{resposta.value}}{{insercaorapidasistema}}{{respostaautomatica.value}}</div>

<ion-textarea name="resposta" #resposta></ion-textarea>

<ion-item>
  <ion-label>Combo 1</ion-label>
  <ion-select #respostaautomatica>
    <ion-option value="opcao 1 ">Opcao 1</ion-option>
    <ion-option value="opcao 2 ">Opcao 2</ion-option>
  </ion-select>
</ion-item>

<ion-item>
  <ion-label>Combo 2</ion-label>
  <ion-select [(ngModel)]="insercaorapidasistema">
    <ion-option value="Opcao 1 ">opcao 1</ion-option>
    <ion-option value="Opcao 2 ">opcao 2</ion-option>
  </ion-select>
</ion-item>
    
03.08.2018 / 21:28