How do I implement ngInit in Angular 8?

I am trying to implement [ngInit] in angular 8 code as said in this link ConvertingAngular1To2ngInit
and it almost worked for me but the problem is it execute more than one time and in some case it go in infinite loop or almost infinite and it crash my page entirely.
so i tried to put the function in the html as {{functionName(5)}} and it executed multiple either even if i am putting it in *ngIf directive.
i even started new project and just put the function in html at least it executed four time
i searched a lot for this problem and got stuck in angular life cycle hooks but understood nothing.

Source: New feed
Source Url How do I implement ngInit in Angular 8?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.