@query
A decorator to query by CSS selector or data-ref attribute.
By default it queries for the first element that matches the selector, but it can be configured to query for all elements.
@query({ selector: "[data-text]"}) text: HTMLElement;
It is possible to query for all elements that match the selector by setting the all
property to true.
@query({ ref: "my-ref", all: true }) allTexts: HTMLElement[]
By default it caches the result of the query, but it can be configured to not cache the result by setting the cache
property to false.
This can be very handful when dealing with dynamic content.
@query({ ref: "list-item", all: true, cache: false }) text: HTMLElement;