To access your drawers, utilize the ViewChild feature.
Incorporate the following code in your template:
<button mat-icon-button (click)="handleClick();><mat-icon>menu</mat-icon></button>
<my-drawer-one #myDrawerOne></my-drawer-one>
<my-drawer-two #myDrawertwo></my-drawer-two>
Add this code to your component:
import { ViewChild, ... } from '@angular/core';
...
@ViewChild('myDrawerOne') drawer;
@ViewChild('myDrawerTwo') drawer2;
private clickCount: number = 0;
public handleClick(): void {
this.clickCount++;
if(this.clickCount === 1) {
this.drawer.toggle();
return;
}
this.clickCount = 0; // Reset click count when needed
this.drawer2.toggle();
}
This process can also be simplified.