diff --git a/modules/@angular/common/test/directives/ng_template_outlet_spec.ts b/modules/@angular/common/test/directives/ng_template_outlet_spec.ts
index fb3cffd141..3c9c060a03 100644
--- a/modules/@angular/common/test/directives/ng_template_outlet_spec.ts
+++ b/modules/@angular/common/test/directives/ng_template_outlet_spec.ts
@@ -34,6 +34,15 @@ export function main() {
});
});
+ // https://github.com/angular/angular/issues/14778
+ it('should accept the component as the context', async(() => {
+ const template = `` +
+ `{{context.foo}}`;
+
+ fixture = createTestComponent(template);
+ detectChangesAndExpectText('bar');
+ }));
+
it('should do nothing if templateRef is `null`', async(() => {
const template = ``;
fixture = createTestComponent(template);
diff --git a/modules/@angular/core/src/view/util.ts b/modules/@angular/core/src/view/util.ts
index 8984587694..9111896ade 100644
--- a/modules/@angular/core/src/view/util.ts
+++ b/modules/@angular/core/src/view/util.ts
@@ -141,11 +141,11 @@ export function elementEventFullName(target: string, name: string): string {
}
export function isComponentView(view: ViewData): boolean {
- return view.component === view.context && !!view.parent;
+ return !!view.parent && !!(view.parentNodeDef.flags & NodeFlags.Component);
}
export function isEmbeddedView(view: ViewData): boolean {
- return view.component !== view.context && !!view.parent;
+ return !!view.parent && !(view.parentNodeDef.flags & NodeFlags.Component);
}
export function filterQueryId(queryId: number): number {