1
I’m implementing a feature where the user selects an option from select
and is sent to a function that adds to my model.
For some reason, after selecting my option select
, the next field of mine ngfor
some, it reappears if I click above, everything works normal in Ionic serves, but when I run the build pro mobile, after selecting the select
the field of the other index some.
My code:
resposta: string[] = [""];
saudacao: string = '';
<div>
<ion-row>
<div class="col-8">
<ion-item>
<ion-textarea name="resposta{{i}}" [(ngModel)]="resposta[pergunta.id]" value="{{resposta[pergunta.id]}}" placeholder="Resposta" clearInput></ion-textarea>
</ion-item>
</div>
<div class="col-4">
<a (click)="respondePergunta(i)"><ion-icon class="responderperguntaicon" name="ios-arrow-dropright-circle"></ion-icon></a>
<a (click)="presentActionSheet()"><ion-icon id="maisopcoes" color="primary" name="more"></ion-icon></a>
</div>
</ion-row>
<ion-item>
<ion-label>Resposta Automática</ion-label>
<ion-select (ionChange)="adicionaArrayRespostaAutomatica($event, pergunta.id)">
<ion-option value="Sim, temos no estoque ">Sim, temos no estoque</ion-option>
<ion-option value="Não, não temos no momento ">Não, não temos no momento</ion-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label>Inserção Rápida Sistema</ion-label>
<ion-select (ionChange)="adicionaArrayInsercaoRapida($event, pergunta.id)">
<ion-option value="{{saudacao}}">Saudação</ion-option>
</ion-select>
</ion-item>
</div>
My job:
adicionaArrayRespostaAutomatica(event, index){
if(this.resposta[index] == null){
this.resposta[index] = '';
this.resposta[index] = this.resposta[index] + ' ' + event;
}else{
this.resposta[index] = this.resposta[index] + ' ' + event;
}
}
adicionaArrayInsercaoRapida(event,index){
if(this.resposta[index] == null){
this.resposta[index] = '';
this.resposta[index] = this.resposta[index] + ' ' + event;
}else{
this.resposta[index] = event + this.resposta[index];
}
}