ContentChild class

Declares a reference to a single child node projected into <ng-content>.

This annotation semantically similar to ContentChildren, but instead represents a single (or first, if more than one is found) node being queried

  • similar to querySelector instead of querySelectorAll.

See ContentChildren and ViewChildren for full documentation.

Annotations
  • @Target.new({TargetKind.field, TargetKind.setter})

Constructors

ContentChild(Object selector, {Object? read})
const

Properties

descendants → bool
Whether to query only direct children (false) or all children (true).
finalinherited
first → bool
Whether to only query the first child.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
read → Object?
The DI token to read from an element that matches the selector.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selector → Object
Either the class Type or selector String.
finalinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited