What is the purpose of the ngOnInit lifecycle hook in an Angular component?
- To destroy the component
- To handle HTTP requests and API calls
- To initialize component properties
- To subscribe to observables
The ngOnInit lifecycle hook is used to initialize component properties and perform any setup needed when a component is created.
Loading...
Related Quiz
- You are testing a custom pipe that transforms user input into a URL-friendly format. What edge cases should you consider in your tests?
- You are building a complex form that includes a dynamically generated list of items, where each item has multiple fields (e.g., name, quantity, price). How would you structure your form using Angular Reactive Forms?
- You are developing an admin panel with multiple sections (e.g., Users, Products, Orders) and want to ensure that only authenticated administrators can access these sections. How would you use Route Guards to protect these sections?
- How can you use a different class or value in place of a service in testing or certain scenarios?
- For debugging and profiling Angular applications, developers can use the _____ browser extension.