I am creating an Angular component that wraps its own <button>element with some additional features. Buttons do not fire a click event if they are disabled and I want to replicate the same functions. those. provided:
<my-button (click)="onClick()" [isDisabled]="true">Save</my-button>
Is there any way to my-buttonprevent onClick()from calling?
In Angular, you can listen for the host click event this way and stop the event from propagating:
@HostListener('click', ['$event'])
onHostClick(event: MouseEvent) {
event.stopPropagation();
}
This prevents the appearance of bubbles in the elements of the ancestor, but does not stop the output of the built-in (click)output to the same element of the node.
Is there any way to do this?
1:, , , "onClick", , "onClick" "click". .
2: , <button>, . , , , . Hm, , ...