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

127
Vistas
getting the values as 'null' value in LocalStorage.getItem

In my application I have to use the Email value coming from login to dashboard component(both are individual components).

So in login component I have stored the values in localstorage by using setItem as'

login.component.ts

//somecode

if (loggedIn) {
  localStorage.setItem(LocalStorageKey.KEY_CoachGender, this.coachProfile.CoachGender);
  localStorage.setItem(LocalStorageKey.KEY_Email, this.coachProfile.Email);
}

and Dashboard.component.ts

let EmailId = localStorage.getItem(LocalStorageKey.KEY_Email);
this.hubConnection.invoke("Register", EmailId)
console.log("Connected")
console.log(EmailId)

But while I am getting the EmailId from loacal Storage I am getting the null value in console Can anyone help me how to get the value without getting the nullvalue

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

0

I believe that problem is you don't have considered the asynchronicity, probability you don't wait the logging is done before you insert the result in localStorage

about 4 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda