July 2018
Intermediate to advanced
420 pages
8h 46m
English
In the life cycle of an Angular component, after instantiating, the component runs a definite path of execution from its beginning until its end. The most basic way to understand this is through observing the following code:
export class HelloComponent implements OnInit, OnDestroy { constructor() { } ngOnInit() {... Some code goes here}ngOnDestroy() {... Some code goes here}}
In the preceding example, you can see methods called ngOnInit() and ngOnDestroy; the names are very intuitive, and show us that we have a beginning and an end. The ngOnInit() method is implemented through its OnInit interface, and the same goes for the ngOnDestroy() method. As you saw in the previous chapter, the interfaces in TypeScript are ...
Read now
Unlock full access