0

Is it possible to combine the *ngFor directive with content projection?

For example: ...

@Component({
  selector: 'test',
  template: `
    <div>
      <ng-content *ngFor="..."></ng-content> // <-- Phantasy example
    </div>
  `
})
export class TestComponent {
}

...

<test>
    <p>Hello World</p>
</test>

...

So the result in the DOM after compiling might look like:

<test>
   <p>Hello World</p>
   <p>Hello World</p>
   <p>Hello World</p>
</test>
Okyo
  • 357
  • 4
  • 17
  • See also http://stackoverflow.com/questions/37685018/repeating-use-of-ng-content/37685085#37685085, http://stackoverflow.com/questions/37676593/how-to-repeat-a-piece-of-html-multiple-times-without-ngfor-and-without-another/37676946#37676946 – Günter Zöchbauer Apr 26 '17 at 15:18

1 Answers1

0

I don't think this is currently supported, since ng-content resolves at compile-time.

See this issue: #8563

JusMalcolm
  • 1,431
  • 12
  • 10