UNPKG

coreui-angular-ex

Version:

CoreUI Components Library for Angular

27 lines (21 loc) 617 B
import { Directive, HostListener, Input } from '@angular/core'; import { OffcanvasService } from '../offcanvas.service'; @Directive({ selector: '[cOffcanvasToggle]', standalone: true }) export class OffcanvasToggleDirective { /** * Html id attr of offcanvas to toggle. * @type string */ @Input('cOffcanvasToggle') id?: string; constructor( private offcanvasService: OffcanvasService ) {} @HostListener('click', ['$event']) toggleOpen($event: any): void { $event.preventDefault(); this.offcanvasService.toggle({ show: 'toggle', id: this.id }); } }