Imagine you have a modal component, and you want users to define custom header, body, and footer for each modal instance. How would you set up the modal component to achieve this?
- Use Angular Templates for Header, Body, and Footer
- Use ng-container for Header, Body, and Footer
- Use Angular Dynamic Components for Header, Body, and Footer
- Use ng-template for Header, Body, and Footer
To allow users to define custom header, body, and footer for each modal instance in Angular, you should use Angular Dynamic Components. This approach allows users to create and insert components dynamically at runtime, making it suitable for the scenario where custom content needs to be defined for each modal instance. While other options like templates, ng-container, and ng-template can be used for various purposes, they don't provide the same level of flexibility as dynamic components in this context.
Loading...
Related Quiz
- In Angular, to define routes for an application, you typically create an array of ________ objects.
- Which property in the Angular routes configuration is used to define lazy-loaded modules?
- The ______ is a container where one or more views can be attached to a component.
- The ________ guard is used in Angular to decide if a route can be activated.
- When an Observable is no longer needed, it should be ________ to prevent memory leaks.