Skip to content

clickOutside

Created by Dale Nguyen

Import

import { ClickOutside } from 'ngxtension/click-outside';

Usage

Basic

Add clickOutside directive directly to the Angular element.

@Component({
standalone: true,
template: `
<div (clickOutside)="close()"></div>
`,
imports: [ClickOutside],
})
class TestComponent {
close() {
// close logic
}
}

This will trigger the close() method when user clicks outside of the target element.