refactor: misc cleanup

This commit is contained in:
Victor Berchet
2016-07-07 16:35:13 -07:00
parent 749dec7dfb
commit eacc9e6541
16 changed files with 107 additions and 128 deletions

View File

@ -6,11 +6,12 @@
* found in the LICENSE file at https://angular.io/license
*/
import {Directive, TemplateRef, ViewContainerRef} from '@angular/core';
import {Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core';
import {isBlank} from '../facade/lang';
/**
* Removes or recreates a portion of the DOM tree based on an {expression}.
*
@ -35,14 +36,15 @@ import {isBlank} from '../facade/lang';
*
* @stable
*/
@Directive({selector: '[ngIf]', inputs: ['ngIf']})
@Directive({selector: '[ngIf]'})
export class NgIf {
private _prevCondition: boolean = null;
constructor(private _viewContainer: ViewContainerRef, private _templateRef: TemplateRef<Object>) {
}
set ngIf(newCondition: any /* boolean */) {
@Input()
set ngIf(newCondition: any) {
if (newCondition && (isBlank(this._prevCondition) || !this._prevCondition)) {
this._prevCondition = true;
this._viewContainer.createEmbeddedView(this._templateRef);