Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!