Summary
We learned a lot in this chapter! First, you learned how to make components more flexible using content projection. We created a modal component and showcased content projection with a single slot and multiple slots. We also learned that you can’t combine structural directives on projected content.
Next, we did a deep dive into template variables and template references. You learned how to create flexible and dynamic components using ng-template
, how to access the values of components and input properties using template variables, and how to display different templates based on specific conditions. You also learned how to provide context to ng-template
elements to build truly dynamic components that can fit almost all design needs you could have for a component.
Lastly, you learned about dynamic component rendering and loading. You learned when you should use dynamically rendered or loaded components and how you can dynamically render and lazy load components at...