fix(linker): prevent pollution of empty embeddedView context (#10548)

Fixes #10045
This commit is contained in:
Pawel Kozlowski
2016-08-08 18:11:35 +02:00
committed by Alex Rickabaugh
parent 74b57dfa7d
commit 46bbcefb36
3 changed files with 39 additions and 8 deletions

View File

@ -6,14 +6,11 @@
* found in the LICENSE file at https://angular.io/license
*/
import {isBlank} from '../facade/lang';
import {AppElement} from './element';
import {ElementRef} from './element_ref';
import {AppView} from './view';
import {EmbeddedViewRef} from './view_ref';
const EMPTY_CONTEXT = new Object();
/**
* Represents an Embedded Template that can be used to instantiate Embedded Views.
*
@ -51,10 +48,7 @@ export class TemplateRef_<C> extends TemplateRef<C> {
createEmbeddedView(context: C): EmbeddedViewRef<C> {
var view: AppView<C> = this._viewFactory(
this._appElement.parentView.viewUtils, this._appElement.parentInjector, this._appElement);
if (isBlank(context)) {
context = <any>EMPTY_CONTEXT;
}
view.create(context, null, null);
view.create(context || <any>{}, null, null);
return view.ref;
}