33 Inject ,
44 InjectionToken ,
55 OnInit ,
6- ChangeDetectionStrategy
6+ AfterContentInit ,
7+ ChangeDetectionStrategy ,
8+ ViewChild
79} from '@angular/core' ;
810import {
911 trigger ,
@@ -14,9 +16,12 @@ import {
1416} from '@angular/animations' ;
1517import { Router , ActivatedRoute } from '@angular/router' ;
1618import { BreakpointObserver } from '@angular/cdk/layout' ;
19+ import { MatSidenav } from '@angular/material' ;
1720import { Subscription } from 'rxjs/Subscription' ;
1821import { Observable } from 'rxjs/Observable' ;
22+ import { filter } from 'rxjs/operators' ;
1923import { OperatorDoc } from '../../operator-docs/operator.model' ;
24+ import { OperatorMenuService } from '../core/services/operator-menu.service' ;
2025
2126const OPERATOR_MENU_GAP_LARGE = 64 ;
2227const OPERATOR_MENU_GAP_SMALL = 54 ;
@@ -53,12 +58,14 @@ interface OperatorDocMap {
5358 ] )
5459 ]
5560} )
56- export class OperatorsComponent implements OnInit {
61+ export class OperatorsComponent implements OnInit , AfterContentInit {
62+ @ViewChild ( MatSidenav ) _sidenav : MatSidenav ;
5763 public groupedOperators : OperatorDocMap ;
5864 public categories : string [ ] ;
5965
6066 constructor (
6167 private _breakpointObserver : BreakpointObserver ,
68+ private _operatorMenuService : OperatorMenuService ,
6269 @Inject ( OPERATORS_TOKEN ) public operators : OperatorDoc [ ]
6370 ) { }
6471
@@ -67,6 +74,13 @@ export class OperatorsComponent implements OnInit {
6774 this . categories = Object . keys ( this . groupedOperators ) ;
6875 }
6976
77+ ngAfterContentInit ( ) {
78+ this . _operatorMenuService
79+ . menuStatus ( )
80+ . pipe ( filter ( s => ! ! s ) )
81+ . subscribe ( _ => this . _sidenav . open ( ) ) ;
82+ }
83+
7084 get extraSmallScreen ( ) {
7185 return this . _breakpointObserver . isMatched ( '(max-width: 601px)' ) ;
7286 }
0 commit comments