Moving data from one page to another via a button in Ionic 4

Asked

Viewed 54 times

1

In a scenario where I have a home screen with an "ion-input" and a button. When you enter the code in the input and click on the button, I want to be redirected to another page and, I want this other page to display the value typed in the previous page, it would be possible?

Note, the typed code should be saved to an instantiated object on the first page.

Someone knows how to do?

  • Dude, with Angular you could do it using the routes, I don’t know if you’d be gambiarroso in your case. https://www.youtube.com/watch?v=vA49SLthZUw . Searching on this in Ionic 3, I found this link that can help you tbm : https://medium.com/@programadriano/Ionic-3-passing values-between-the-p%C3%A1ginas-c816e4d34191

  • 1

    Hello, already solved, very simple. Just add in your route, in Path, the name of the page + parameter: {path: "new-item/:id"} and then in tamplate call so: <ion-input type="text" name="ticket" [(ngModel)]="ticket"></ion-input>&#xA; <ion-button [routerLink]="['/new-item', ticket]">Confirmar</ion-button>

  • What expensive dough, put as your answer and then mark as solved to help other people.

  • You can mark your own answer as the resolution of your question two days after publishing, this makes the little box next to your question green.

No answers

Browser other questions tagged

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