From df759b8d4b9ab676e44482c05bc1f302dcb74a6e Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Thu, 23 Jun 2016 17:51:39 +0200 Subject: [PATCH] fix(core): improve error message for broken bindings Fixes #6820 Closes #9536 --- modules/@angular/compiler/src/template_parser.ts | 4 ++-- modules/@angular/compiler/test/template_parser_spec.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/@angular/compiler/src/template_parser.ts b/modules/@angular/compiler/src/template_parser.ts index 40361534b1..4d657fa884 100644 --- a/modules/@angular/compiler/src/template_parser.ts +++ b/modules/@angular/compiler/src/template_parser.ts @@ -824,7 +824,7 @@ class TemplateParseVisitor implements HtmlAstVisitor { } elementProps.forEach(prop => { this._reportError( - `Property binding ${prop.name} not used by any directive on an embedded template`, + `Property binding ${prop.name} not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "directives" section.`, sourceSpan); }); } @@ -840,7 +840,7 @@ class TemplateParseVisitor implements HtmlAstVisitor { events.forEach(event => { if (isPresent(event.target) || !SetWrapper.has(allDirectiveEvents, event.name)) { this._reportError( - `Event binding ${event.fullName} not emitted by any directive on an embedded template`, + `Event binding ${event.fullName} not emitted by any directive on an embedded template. Make sure that the event name is spelled correctly and all directives are listed in the "directives" section.`, event.sourceSpan); } }); diff --git a/modules/@angular/compiler/test/template_parser_spec.ts b/modules/@angular/compiler/test/template_parser_spec.ts index e5c62ca1cc..c09c59ca3f 100644 --- a/modules/@angular/compiler/test/template_parser_spec.ts +++ b/modules/@angular/compiler/test/template_parser_spec.ts @@ -1220,9 +1220,9 @@ More than one component: DirB,DirA ("[ERROR ->]
"): TestComp@0:0`); }); expect(() => parse('', [dirA])) .toThrowError(`Template parse errors: -Event binding e not emitted by any directive on an embedded template (""): TestComp@0:18 +Event binding e not emitted by any directive on an embedded template. Make sure that the event name is spelled correctly and all directives are listed in the "directives" section. (""): TestComp@0:18 Components on an embedded template: DirA ("[ERROR ->]"): TestComp@0:0 -Property binding a not used by any directive on an embedded template ("[ERROR ->]"): TestComp@0:0`); +Property binding a not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "directives" section. ("[ERROR ->]"): TestComp@0:0`); }); it('should not allow components or element bindings on inline embedded templates', () => { @@ -1234,7 +1234,7 @@ Property binding a not used by any directive on an embedded template ("[ERROR -> }); expect(() => parse('
', [dirA])).toThrowError(`Template parse errors: Components on an embedded template: DirA ("[ERROR ->]
"): TestComp@0:0 -Property binding a not used by any directive on an embedded template ("[ERROR ->]
"): TestComp@0:0`); +Property binding a not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "directives" section. ("[ERROR ->]
"): TestComp@0:0`); }); });