docs: fix `ngProjectAs` selector in example (#42523)

Fixes #42522

PR Close #42523
This commit is contained in:
Pete Bacon Darwin 2021-06-09 07:09:28 +01:00 committed by Alex Rickabaugh
parent 28a4631b63
commit e36c5b4c86
4 changed files with 6 additions and 2 deletions

View File

@ -34,7 +34,7 @@
<app-zippy-ngprojectas>
<p>Let's learn about content projection!</p>
<!-- #docregion ngprojectas-->
<ng-container ngProjectAs="question">
<ng-container ngProjectAs="[question]">
<p>Is content projection cool?</p>
</ng-container>
<!-- #enddocregion-->

View File

@ -4,7 +4,9 @@ import { Component } from '@angular/core';
selector: 'app-zippy-multislot',
template: `
<h2>Multi-slot content projection</h2>
Default:
<ng-content></ng-content>
Question:
<ng-content select="[question]"></ng-content>
`
})

View File

@ -4,7 +4,9 @@ import { Component } from '@angular/core';
selector: 'app-zippy-ngprojectas',
template: `
<h2>Content projection with ngProjectAs</h2>
Default:
<ng-content></ng-content>
Question:
<ng-content select="[question]"></ng-content>
`
})

View File

@ -154,4 +154,4 @@ The `ng-container` element is a logical construct that you can use to group othe
</div>
In this example, the content we want to project resides inside another element. To project this content as intended, the template uses the `ngProjectAs` attribute. With `ngProjectAs`, the entire `ng-container` element is projected into a component using the `question` selector.
In this example, the content we want to project resides inside another element. To project this content as intended, the template uses the `ngProjectAs` attribute. With `ngProjectAs`, the entire `ng-container` element is projected into a component using the `[question]` selector.