Créer une directive de confirmation de suppression

I have the following link with a custom directive confirmDelete:

<a (click)="deleteEntity()" confirmDelete>Delete</a>

I would like my directive confirmDelete to detach the (click) handler and replace it by its own which displays a confirmation modal that confirms the deletion. If the user confirms, then the original click handler should be called. If the user doesn’t confirm, then nothing should happen.

Another implementation that would be acceptable is:

<a deleteAction="deleteEntity()" confirmDelete>Delete</a>

Ressources : - Inspect attached event handlers for any DOM element - http://stackoverflow.com/a/2623352