1

This is a double question... or maybe one is the question and the other the consequence of not knowing the answer to the question..

I have an Angular2/4 App that it started to freezed always in the same screen... Not in the other ones... I want to know what is causing this issue... But I have no idea about how to debug performance issues in Angular. Is there a way to do that?

And apart from that... Is there a good practise about how to avoid this? I mean, when and where to use ngOnDestroy, avoid/limit the use of subscription/observables. Not to use ngZone.. etc...

In my app I use subscription get the result from API calls, for params send in the URL (like /product/2), and also for translate. And I use ngZone when I need to get a change in a child component made in the parent.

Some code examples are:

this.translateService.get('COMPONENT.INVOICE.CONFIRM-VALUES').subscribe(
      data => {
           this.text = data;
      });

this.countryService.get().subscribe( (response : JsonResponse) => {....});

this._route.params.subscribe((params: Params) =>{ ... });

Adding some images of the chrome performance tool:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Faabass
  • 1,394
  • 8
  • 29
  • 58
  • Open developer tools and check the network and performance tab. – Kyle Krzeski May 14 '18 at 13:25
  • @WilliamHampshire I added some image of the performance test output. It seems that ngZone is freezing the app... But I remove it from several places in the code and the behavior is the same – Faabass Jul 03 '18 at 12:42

0 Answers0