angular2-clickoutside-directive

1.1.5 • Public • Published

angular2-clickoutside-directive

Angular 2 directive that provides Click Outside Functionality

npm version

forthebadge

Install

npm i angular2-clickoutside-directive --save

Import the directive to your project and use it in your Component defining an event handler

import { ClickOutsideDirective } from 'angular2-clickoutside-directive';
 
@Component({
  selector: 'my-app',
  template : `
  <button clickOutside (onClickOutside)="onClickOutside($event)">
    A button
  </button>`,
  directives : [  ClickOutsideDirective ]
} )
class MyFirstComponent implements OnInit {
  constructor(){}
 
  onClickOutside($event)
  {
    console.log('Clicked outside')
  }
 
  ngOnInit(){}
}

Contribute

Any pull-request is more than welcome 💥 😄

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code.

License

MIT

Package Sidebar

Install

npm i angular2-clickoutside-directive

Weekly Downloads

1

Version

1.1.5

License

MIT

Last publish

Collaborators

  • avrmav