Angular6 is executed after the page is loaded, not ngOnInit

my front end uses Angular6, to call a method of Angular
after the page is loaded and tested in ngOnInit (), which seems to be executed before the page is loaded.
so what should I do if I want to execute a method of Angular6 after the page is all loaded?
has read the official documents and only has the following hooks on the life cycle:
constructor ()
ngOnChanges ()
ngOnInt ()
ngDoCheck ()
ngAfterContentInit ()
ngAfterContentChecked ()
ngAfterViewInit ()
ngAfterViewChecked ()
ngOnDestory ()
ngAfterContentInit () and ngAfterViewInit ()
have been tested, and neither of them is
thanks any help!

Jul.06,2021

it is estimated that the component you want to execute is not included in the first page of your application settings!


ngAfterViewInit()

ngAfterViewInit is executed after all pages have been rendered. You can try

.

I also have the same problem. Both ngAfterViewInit and ngAfterContentInit have tried this method, but it really doesn't work. It starts when the page is not loaded and cannot even get the passed parameters.


ngOnInit () {

setTimeout(()=>{
    // 
},0)

}

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c2301f-3361b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c2301f-3361b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?