Can we have two ng-content with same select attribute?

angular

Solution

update Angular 5

`ngOutletContext` was renamed to `ngTemplateOutletContext`

See also https://github.com/angular/angular/blob/master/CHANGELOG.md#500-beta5-2017-08-29

original

No, that's not supported.

Every element matching the selector will be projected to the first `<ng-content>`.

Perhaps `ngTemplateOutlet` or `ngForTemplate` is what you're looking for.

See also

- How to repeat a piece of HTML multiple times without ngFor and without another @Component

Problem

``` <div class="main"> <ng-content select="[body]"></ng-content> </div> <div class="main-copy"> <ng-content select="[body]"></ng-content> </div> ``` I am trying to copy the same content into main-copy but unfortunately it is not working. Any suggestion?

Original source

Related problems