call expression invokes a method, using parameters specified within the attribute value. This method gets executed in response to an event. The event that instigates the call action is located to the left of the “.call” keyword, while specifics about what method to invoke are on its right.
As for which events can be invoked, there’s no specific constraint. Whenever a dispatch event is triggered, you have the flexibility to employ the “.call”. Behind the scenes, the call action handles the addEventListener method. This implies that, provided you can utilize addEventListener, you have the capability to link to that event via the “.call”.
- call a method on the binding context
- call a method on the binding context with parameters
- call a method on a element
- call a method on a element with parameters
<button click.call="methodName">...<button> <button click.call="methodName(10, "greeting", $event)>...</button> <button click.call="[query].methodName">...</button> <button click.call="[query].methodName(10, "greeting", $event)>...</button>
From the given information, we have four illustrative examples.