Skip to content

Instantly share code, notes, and snippets.

@nhamilakis
Last active November 13, 2019 14:37
Show Gist options
  • Save nhamilakis/eb178344c9f1d61b3ec2056605e423f0 to your computer and use it in GitHub Desktop.
Save nhamilakis/eb178344c9f1d61b3ec2056605e423f0 to your computer and use it in GitHub Desktop.
Block Click Events in Angular
import { Directive, HostListener} from '@angular/core';
@Directive({
selector: '[noClickable]'
})
export class ComponentLockDirective {
constructor() { }
@HostListener('click', ['$event'])
public onClick(event: any): void {
event.stopPropagation();
}
}
<div noClickable> bitch can not click me </div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment