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