Last active
August 5, 2018 16:30
-
-
Save venkateshwarv/e78c5f215b87ea8659b37b3a4816730f to your computer and use it in GitHub Desktop.
Typescript for step one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Portal, TemplatePortal } from '@angular/cdk/portal'; | |
// [redacted] | |
showPopUp() { | |
if ( !this._overlayOpened) { | |
this._startAnimation(); | |
this.input.setValue( '', { emitEvent: true } ); | |
this._overlayOpened = true; | |
this._createOverlay().attach( this._portal ); | |
} | |
} | |
private _createOverlay(): OverlayRef { | |
if ( !this._overlayRef ) { | |
this._portal = new TemplatePortal( | |
<any>this.optionsPanel, | |
this._viewContainerRef | |
); | |
const config = this._getOverlayConfig(); | |
this._overlayRef = this._overlay.create( config ); | |
this._overlayRef.backdropClick().subscribe( () => { | |
this.closeMenu(); | |
} ); | |
} | |
return this._overlayRef; | |
} | |
closeMenu() { | |
this._resetAnimation(); | |
if ( this._overlayRef && !this.inlineOptions ) { | |
this._overlayOpened = false; | |
this._overlayRef.detach(); | |
this._overlay = null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment