diff --git a/packages/core/src/render3/definition.ts b/packages/core/src/render3/definition.ts index 13ea394cfd..bdf33b1176 100644 --- a/packages/core/src/render3/definition.ts +++ b/packages/core/src/render3/definition.ts @@ -36,8 +36,11 @@ export function defineComponent(componentDefinition: ComponentDefArgs): Co n: componentDefinition.factory, tag: (componentDefinition as ComponentDefArgs).tag || null !, template: (componentDefinition as ComponentDefArgs).template || null !, - r: componentDefinition.refresh || - function(d: number, e: number) { componentRefresh(d, e, componentDefinition.template); }, + r: componentDefinition.refresh || (componentDefinition.template ? + function(d: number, e: number) { + componentRefresh(d, e, componentDefinition.template); + } : + noop), h: componentDefinition.hostBindings || noop, inputs: invertObject(componentDefinition.inputs), outputs: invertObject(componentDefinition.outputs), diff --git a/packages/core/test/render3/compiler_canonical_spec.ts b/packages/core/test/render3/compiler_canonical_spec.ts index 3e589dde34..f6a8fdad3a 100644 --- a/packages/core/test/render3/compiler_canonical_spec.ts +++ b/packages/core/test/render3/compiler_canonical_spec.ts @@ -95,6 +95,7 @@ describe('compiler specification', () => { r3.T(3, '!'); } ChildComponent.ngComponentDef.r(1, 0); + SomeDirective.ngDirectiveDef.r(2, 0); } }); // /NORMATIVE @@ -112,7 +113,7 @@ describe('compiler specification', () => { xit('should support structural directives', () => { const log: string[] = []; @Directive({ - selector: 'if', + selector: '[if]', }) class IfDirective { constructor(template: TemplateRef) { log.push('ifDirective'); } @@ -180,7 +181,8 @@ describe('compiler specification', () => { r3.e(); r3.T(2); } - r3.t(2, r3.b1('Hello ', r3.m(1).value, '!')); + const l1_user = r3.m(1); + r3.t(2, r3.b1('Hello ', l1_user.value, '!')); } }); // NORMATIVE