igniteui-angular-sovn
Version:
Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps
59 lines (50 loc) • 1.36 kB
text/typescript
import { Directive, HostListener, Input } from '@angular/core';
import { IgxNavigationService } from './nav.service';
/**
* Directive that can toggle targets through provided NavigationService.
*
* Usage:
* ```
* <button igxNavToggle="ID"> Toggle </button>
* ```
* Where the `ID` matches the ID of compatible `IToggleView` component.
*/
export class IgxNavigationToggleDirective {
private target;
public state: IgxNavigationService;
constructor(nav: IgxNavigationService) {
this.state = nav;
}
public toggleNavigationDrawer() {
this.state.toggle(this.target, true);
}
}
/**
* Directive that can close targets through provided NavigationService.
*
* Usage:
* ```
* <button igxNavClose="ID"> Close </button>
* ```
* Where the `ID` matches the ID of compatible `IToggleView` component.
*/
export class IgxNavigationCloseDirective {
private target;
public state: IgxNavigationService;
constructor(nav: IgxNavigationService) {
this.state = nav;
}
public closeNavigationDrawer() {
this.state.close(this.target, true);
}
}