I\'m using Angular 2 Material sidenav in my project this way:
The simplest way for was to pass the drawer to the component that triggers the toggle.
Html:
....
another-component TS:
export class AnotherComponent implements OnInit {
@Input() drawerRef: MatDrawer;
...
}
another-component HTML:
Where another-component is the component that controls the toggle action.