Questions about angular initialization information?

clipboard.png

three initializations
1. Initialize
2 when defining. Initialize
3 in the constructor What is the difference between initializing
in ngOnInit? Under what circumstances do you usually use which initialization? What is the order in which page rendering is performed in three initializations?


1 is just the syntax sugar of 2, and

is executed in the constructor after compilation.

ngOnInit is executed after constructor, and the component has been constructed when ngOnInit is executed. You can get the properties of the component, such as those entered through @ Input , while the component is still being constructed when constructor is executed, and almost all properties have no value

.

from a development point of view, some fixed value assignments are generally performed in constructor (such as headerSlides); in your figure and some initialization logic in ngOnInit, such as requesting the server to get initialization data

).
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-1b32e3d-2be63.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-1b32e3d-2be63.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?