Coding task · Angular course · Module 2: Components

Practice: Lifecycle Hooks

ngOnInit() is called after the component is initialized - ideal for fetching data. ngOnDestroy() is used to clean up resources (subscriptions, timers).

Task

Implement the OnInit and OnDestroy interfaces, along with the corresponding lifecycle hook methods.