Getting Access to ng-content with @ContentChild in Angular


When to use @ViewChildren
You should use @ViewChildren when you have added the element you are trying to grab directly to the component yourself, in other words, if the element you are grabbing is not added to the component you are working with through content projection with

When to use @ContentChildren
You can use @ContentChildren to grab a reference to content that has been projected into a component through the use of

<expandable-header [scrollArea]="mycontent" headerHeight="125">
            <ion-label><ion-icon name="search"></ion-icon></ion-label>
            <ion-input type="text"></ion-input>

            <ion-label><ion-icon name="funnel-outline"></ion-icon></ion-label>
            <ion-input type="text"></ion-input>
@ContentChildren(Item) items: any;