• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

244
Vistas
Best way to save data before directing to external page (and then fetch it when going back to my page)?

I have an angular application with a page with a form inside. In that page there is also a link to an external website. In the external website the user does something and then is directed back to my page.

I would like the data the user initially adds to my page's form to be saved so that when the user comes back from the external website, he will find the initial page with all the information he inserted.

The only solution that comes to mind is cookies/localStorage. So for example I would have to save all the data in the localStorage, go to the external website, come back to my page, and load the data from the localStorage.

Is that the only way or is there a better solution?

Thank you!

about 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Retrieving Data from route

You could set your desired data in the route and retrieve it in your Angular application. For Example, you want to check whether or not your user has checked something once they have been redirected to the external website; all you need to do is set a query param and then check it once the user comes back to your original web application.

e.g.:

yourwebsite.com/home?hasSelected=true

And in your component, you can access it like below:

constructor(private readonly activatedRoute: ActivatedRoute) { }

ngOnInit() {
    this.param1 = this.activatedRoute.snapshot.paramMap.get('param1');
}

You can learn more about getting data from query params Here.

about 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda