YUNOVA · Angular
Module 12: Angular architecture
Custom directives
Key points
- An attribute directive changes how an existing element looks or behaves.
- @HostListener and @HostBinding react to events and set properties.
- Structural directives use TemplateRef and ViewContainerRef to add or remove views.
Content projection and ng-template
Key points
- ng-content projects content from the parent into a component.
- The select attribute projects content into named slots.
- ng-template defines markup that renders only when used.
Dynamic components
Key points
- ViewContainerRef.createComponent creates a component at runtime.
- Inputs can be set on the created component with setInput.
- Dynamic components suit dialogs, tabs and plugin-style layouts.
Angular libraries and Nx monorepo
Key points
- ng generate library creates a reusable Angular library.
- Nx manages many apps and libraries in one repository.
- Nx affected commands build and test only what changed.