contentChildren
Initializes a content children query.
contentChildren(locator: string | ProviderToken<LocatorT>, opts?: { descendants?: boolean; read?: undefined; }): Signal<ReadonlyArray<LocatorT>>
Parameters
locator
|
string | ProviderToken<LocatorT> |
|
opts
|
object |
Optional. Default is |
Returns
Signal<ReadonlyArray<LocatorT>>
contentChildren(locator: string | ProviderToken<LocatorT>, opts: { descendants?: boolean; read: ProviderToken<ReadT>; }): Signal<ReadonlyArray<ReadT>>
Parameters
locator
|
string | ProviderToken<LocatorT> |
|
opts
|
object |
Returns
Signal<ReadonlyArray<ReadT>>
Description
Query results are represented as a signal of a read-only collection containing all matched elements.
Further information is available in the Usage Notes...
Usage notes
Create a children query in your component by declaring a
class field and initializing it with the contentChildren()
function.
@Component({...})
export class TestComponent {
headerEl = contentChildren<ElementRef>('h'); // Signal<ReadonlyArray<ElementRef>>
}