Created
December 19, 2016 02:09
-
-
Save ashish173/f699749c940924c458f433e3dd51eba3 to your computer and use it in GitHub Desktop.
Update view for NgIf Else Directive
This file contains 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
private _updateView() { | |
if (this._context.$implicit) { | |
if (!this._thenViewRef) { | |
this._viewContainer.clear(); | |
this._elseViewRef = null; | |
if (this._thenTemplateRef) { | |
this._thenViewRef = | |
this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context); | |
} | |
} | |
} else { | |
if (!this._elseViewRef) { | |
this._viewContainer.clear(); | |
this._thenViewRef = null; | |
if (this._elseTemplateRef) { | |
this._elseViewRef = | |
this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment