How to store an ion-input value in a variable and pass it on the route?

Asked

Viewed 219 times

0

Imagine the following scenario in Ionic 4: I have an ion-input for the user to enter a Ticket number. I want to store this value in a variable in the component class and then use it to pass as route parameter.

In this context, I am not able to store the value typed in the ion-input variable, someone knows how to do this?

1 answer

1


Good afternoon,

You can thus do your input by giving a name with the same name as ngModel and create its variable type like 'public test: string;'

<ion-input  name="teste" [(ngModel)]="teste" class="nome" type="text" ></ion-input>```
  • great, I knew it was easy, I forgot about the "name" rsrs Thanks! Now my Template looks like this: <ion-input type="text" name="ticket" [(ngModel)]="ticket"></ion-input>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.