Suppose I have a component Parent that content projects Child components as follows. In this case, Child is an abstract base class that is extended by components ChildA and ChildB. Here's an example use cased in a user's template:
<parent>
  <child-a></child-a> // or child-b
</parent>
In the Parent's template I want to use <ng-content> to content project the Child component.  However, I want to be able to use <ng-content> and somehow select either the <child-a> or <child-b>, something like:
<ng-content select="child-a | child-b"></ng-content>
Is there a way to do this?
You can do this using a comma separated list like this:
<ng-content select="child-a,child-b"></ng-content>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With