Saltar al contenido principal

Variable: useQuerySelector

const useQuerySelector: {<K>(selector): HTMLElementTagNameMap[K] | null; <E>(selector): E | null; }

Defined in: src/infrastructure/dom/dom.service.ts:112

Returns the first element matching a CSS selector.

Call Signature

<K>(selector): HTMLElementTagNameMap[K] | null

Type Parameters

K

K extends keyof HTMLElementTagNameMap

Parameters

selector

K

Returns

HTMLElementTagNameMap[K] | null

Call Signature

<E>(selector): E | null

Type Parameters

E

E extends Element = HTMLElement

Parameters

selector

string

Returns

E | null

Type Param

E

The expected Element subtype.

Param

selector

A CSS selector string.

Returns

The matching element, or null.

Example

const el = useQuerySelector<HTMLElement>(".my-class");