ContentChild

ContentChild decorator

What it does

Configures a content query.

How to use

.

import {AfterContentInit, ContentChild, Directive} from '@angular/core';

@Directive({selector: 'child-directive'})
class ChildDirective {
}

@Directive({selector: 'someDir'})
class SomeDir implements AfterContentInit {
  @ContentChild(ChildDirective) contentChild: ChildDirective;

  ngAfterContentInit() {
    // contentChild is set
  }
}

Description

You can use ContentChild to get the first element or the directive matching the selector from the conten