Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

71
Vistas
NgOnInit is not called

I have a page where in my ngOnInit I check from where I arrive (for example, if I arrive from page1 I set a variable that I use to show an html, or from page2 another variable to show another html)

ngOnInit() {
       this.handleParams();
}


handleParams(){
    this.isNewCustomer = JSON.parse(
      localStorage.getItem(LocalstorageKeyEnum.NEW_CUSTOMER)
    );

    let params = this.route.snapshot.queryParams;
    if (params.customerCreate === true) {
      this.customerCreate = true;
    }

    this.isUpdate = JSON.parse(
      localStorage.getItem(LocalstorageKeyEnum.IS_UPDATE)
    );
}

Now I notice that this my ngOnInit() is called only one time, so every time I enter in the page I The handleParams is not checked.

How can I get the ngOnInit called?

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

What is your correct question? Is ngOnInit called once or never? It's correct when it's called just once you entering the page. Maybe your routing to the localStorage is wrong? It's just a simple call - e. g.:

localStorage.setItem('savePage', setUrlFromPage);
const myPage = localStorage.getItem('savePage');
about 4 years ago · Santiago Gelvez 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda