Is it possible to define a condition in the template based on which a click handler is attached?
For instance, the closest I can get is evaluating a condition at the
I would suggest you write a handler that performs the conditional action, this is the simplest way IMHO :
In Component template :
in Component code .ts :
myClickHandler(event): void {
if (this.isOverflown) {
this.menu.toggle(event);
}
}
EDIT after comment : if you really want to avoid binding (I don't understand why, but anyway) you can have a conditional component using *ngIf
: