tezvyn:

Angular's ng-template: Reusable UI Blueprints

Source: angular.devintermediate

ng-template defines a reusable UI blueprint that isn't rendered by default. Use it with ngTemplateOutlet to create configurable components, like passing a custom item layout to a generic list.

ng-template lets you define a chunk of UI as a reusable blueprint that Angular won't render immediately. It's often paired with the ngTemplateOutlet directive, which stamps out the template where needed. This is perfect for creating generic components, like a data table that lets consumers provide a custom template for cells. The main footgun is context: bindings inside the template always resolve to the component where it was defined, not where it's eventually rendered by the outlet.

Read the original → angular.dev

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Angular's ng-template: Reusable UI Blueprints · Tezvyn