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

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

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 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!