license import { Directive , TemplateRef } from '@angular/core' ; import { Menu } from './menu-interface' ; import { MenuStack } from './menu-stack' ; /**
 * Directive applied to an ng-template which wraps a CdkMenu and provides a reference to the
 * child element it wraps which allows for opening of the CdkMenu in an overlay.
 */ @ Directive ( { selector : 'ng-template[cdkMenuPanel]' , exportAs : 'cdkMenuPanel' } ) export class CdkMenuPanel { /** Reference to the child menu component */ _menu ? : Menu ; /** Keep track of open Menus. */ _menuStack : MenuStack | null ; constructor ( readonly _templateRef ) { } /**
     * Set the Menu component on the menu panel. Since we cannot use ContentChild to fetch the
     * child Menu component, the child Menu must register its self with the parent MenuPanel.
     */ _registerMenu ( child ) { this . _menu = child ; this . _menu . _menuStack = this . _menuStack ; this . _menuStack ?. push ( child ) ; } }