diff --git a/src/app/modules/admin/ui/fuse-components/components/drawer/drawer.component.html b/src/app/modules/admin/ui/fuse-components/components/drawer/drawer.component.html index ab2840e2..baca5872 100644 --- a/src/app/modules/admin/ui/fuse-components/components/drawer/drawer.component.html +++ b/src/app/modules/admin/ui/fuse-components/components/drawer/drawer.component.html @@ -241,7 +241,7 @@ @@ -249,7 +249,7 @@ class="ml-4" mat-flat-button [color]="'primary'" - (click)="toggleDrawerOpen('leftDrawer');"> + (click)="toggleDrawerOpen();"> Toggle drawer open @@ -257,12 +257,12 @@ + [opened]="drawerOpened" + [mode]="drawerMode" + (openedChanged)="drawerOpenedChanged($event)">
Left drawer -
Current mode: {{drawer.mode}}
+
Current mode: {{drawerMode}}
@@ -285,7 +285,7 @@ @@ -293,15 +293,15 @@ class="ml-4" mat-flat-button [color]="'primary'" - (click)="toggleDrawerOpen('leftDrawer');"> + (click)="toggleDrawerOpen();"> Toggle drawer open
+ [opened]="drawerOpened" + [mode]="drawerMode">
Left drawer
@@ -310,6 +310,20 @@
Some content
+ +
@@ -322,26 +336,34 @@ diff --git a/src/app/modules/admin/ui/fuse-components/components/drawer/drawer.component.ts b/src/app/modules/admin/ui/fuse-components/components/drawer/drawer.component.ts index 4a92348a..02b54e45 100644 --- a/src/app/modules/admin/ui/fuse-components/components/drawer/drawer.component.ts +++ b/src/app/modules/admin/ui/fuse-components/components/drawer/drawer.component.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { FuseDrawerMode, FuseDrawerService } from '@fuse/components/drawer'; +import { FuseDrawerMode } from '@fuse/components/drawer'; import { FuseComponentsComponent } from 'app/modules/admin/ui/fuse-components/fuse-components.component'; @Component({ @@ -9,17 +9,18 @@ import { FuseComponentsComponent } from 'app/modules/admin/ui/fuse-components/fu export class DrawerComponent { drawerMode: FuseDrawerMode; + drawerOpened: boolean; /** * Constructor */ constructor( - private _fuseDrawerService: FuseDrawerService, private _fuseComponentsComponent: FuseComponentsComponent ) { // Set the defaults this.drawerMode = 'side'; + this.drawerOpened = true; } // ----------------------------------------------------------------------------------------------------- @@ -28,32 +29,28 @@ export class DrawerComponent /** * Toggle the drawer mode - * - * @param name */ - toggleDrawerMode(name: string): void + toggleDrawerMode(): void { - const drawer = this._fuseDrawerService.getComponent(name); - - if ( drawer ) - { - drawer.mode = drawer.mode === 'side' ? 'over' : 'side'; - } + this.drawerMode = this.drawerMode === 'side' ? 'over' : 'side'; } /** * Toggle the drawer open - * - * @param name */ - toggleDrawerOpen(name: string): void + toggleDrawerOpen(): void { - const drawer = this._fuseDrawerService.getComponent(name); + this.drawerOpened = !this.drawerOpened; + } - if ( drawer ) - { - drawer.toggle(); - } + /** + * Drawer opened changed + * + * @param opened + */ + drawerOpenedChanged(opened: boolean): void + { + this.drawerOpened = opened; } /**