ngx-yazuo-click-outside

A simple directive for get clicks outside from elements

Usage no npm install needed!

<script type="module">
  import ngxYazuoClickOutside from 'https://cdn.skypack.dev/ngx-yazuo-click-outside';
</script>

README

NgxYazuoClickOutside

Installation

npm install --save ngx-yazuo-click-outside

Usage

Module:

Import NgxYazuoClickOutside from ngx-yazuo-click-outside

import { NgxYazuoClickOutsideModule } from 'ngx-yazuo-click-outside';

@NgModule({
  // ...
  imports: [
    NgxYazuoClickOutsideModule
  ]
  // ...
})
export class MyAppModule {}

Markup

Use the NgxYazuoClickOutsideDirective passing the parameters allowedClickedClasses and allowedClickedIds for classes and id's to allow clicking, respectively.

    <div class="content" (ngx-yazuo-click-outside)="outsideClicked()" [allowed-clicked-classes]="classesList" [allowed-clicked-ids]="idsList">
    </div>

Component


@Component({
  // ...
})
export class AppComponent implements {

    classesList = ['class1', 'class2', 'class3'];
    idsList = ['id1', 'id2', 'id3'];


    constructor() {}

    outsideClicked() {
      // ...
    }
}