Loading topic
<ng-content /> element turns a component into a reusable wrapper. It assumes you can write standalone Angular components with templates and selectors, and that you read basic TypeScript. Named slots, fallback content, and content queries come in 6 min read<ng-content /> slot that receives everything the parent places between the component's tags. This chapter covers components that need several slots. It assumes you can write a standalone component, know the CSS selector syntax for element names, attributes and 6 min read<ng-content /> projects the parent's markup, and you have seen select route content into named slots. Here you will learn exactly which content ends up in the default slot, which content never reaches it, and the mi6 min readselect attribute of ng-content from the previous chapters, and you can read a CSS attribute selector such as [panel-title]. After it, you will be able to send several sibling nodes into one named slot without addin7 min read<ng-content> element in a component's template. The parent fills it with markup placed between the component's tags. Sometimes the parent has nothing to put there. A card with no title, a dialog with no footer, or a panel with no icon can each leave a hole in the la6 min readng-content with select, and read basic change detection terms such as "checked" and OnPush. It covers one rule: the component whose template contains the projected markup owns that markup. The sections below follow what that rule im5 min readng-content with and without select, and read basic lifecycle hooks such as ngOnInit. It covers a rule that surprises many developers: putting <ng-content> inside an @if does not stop the projected content from being crea6 min readng-content wit6 min readng-content, select slots and content queries work, as covered in the earlier chapters. It also assumes you can write a standalone component with signal inputs. Here you will learn when plain projection is the wrong tool and how ng-template with `ngTemplateOutl5 min readng-content, the select attribute, and how ng-template works. So far, every projected node came from a parent template. Angular matched the parent's content to the slots at compile time. A component created from code has no parent template, so there is nothing to m6 min readng-content, and the design rules that avoid them. It assumes you can write Angular components with signal inputs, that you know the select attribute, ngProjectAs, fallback content and content queries from the earlier chapter6 min read