Within my application, there is a button that has a click event attached to it:
<button class="btn btn-default" (click)="doSomething()">
I am wondering if there is a way to remove the (click)
event from the button within the doSomething
method so that users cannot trigger the functionality anymore.
I attempted to set a disabled property on the button, but it did not change Angular2's behavior.
I also tried using (click)="doSomething($event)"
and then
doSomething($event) {
// The logic of my method is implemented here
...
...
console.log('Method Logic');
// Attempting to override the click event
let target = event.target || event.srcElement || event.currentTarget;
this.renderer.listen(target, 'click', (event) => {
console.log('Click block');
});
}
However, this approach does not successfully replace the click event. As a result, both the original logic and the "click block" console log are triggered upon clicking.