on()
Adds an event handler to all instances of the UI element.
on(
eventName: string,
handler: string | ViewBuilderEventHandler<TView, any>,
): this;
Notes
- Listens for events on all instances of the UI element, including events propagated from nested views.
- Multiple handlers can be added.
- String handlers emit a transformed event; the original is still emitted on the view but does not propagate to parents.
- Function handlers can return
trueor callevent.stopPropagation()to stop propagation.
Parameters
- eventName — The name of the event to handle.
- handler — The function to call, or name of the transformed event to emit.
Return value
The builder instance for chaining.
Related
class ElementBuilder abstractstatic
An abstract base class for UI element builders.
