0

I see problem in my angular project, on some pages I didn't understand why request were made twice on page refresh. I noticed that the init was called twice in my components. I thought to myself that this was going to be a complicated problem given the size of the project which contains a lot of lazy loading with outlet routing. But I noticed that even the app.component init was being called twice. Which I don't understand because it's the highest element in the hierarchy?

ngOnInit(): void {
this.translationService.init('customer-en');
console.log('appInit')

if (navigator.userAgent.includes("Window")) {
   this.window = true;
 }
}
Salahuddin Ahmed
  • 4,854
  • 4
  • 14
  • 35
Nicolas M
  • 475
  • 1
  • 7
  • 14
  • 1
    Does this answer your question? https://stackoverflow.com/questions/38787795/why-is-ngoninit-called-twice/54791011 – dom.macs Oct 05 '21 at 02:08
  • yes, thanks ! in my main.ts i had two platformBrowserDynamic().bootstrapModule(AppModule) .catch(err => console.error(err)); – Nicolas M Oct 06 '21 at 00:55

0 Answers0