fix(compiler): improve error msg for unknown properties on (#14373)

ng-container/ng-content

Closes #14070

PR Close #14373
This commit is contained in:
Dzmitry Shylovich
2017-02-09 21:22:44 +03:00
committed by Miško Hevery
parent 2c6dab970b
commit e5a144d902
2 changed files with 15 additions and 1 deletions

View File

@ -729,7 +729,11 @@ class TemplateParseVisitor implements html.Visitor {
!this._schemaRegistry.hasProperty(elementName, boundProp.name, this._schemas)) {
let errorMsg =
`Can't bind to '${boundProp.name}' since it isn't a known property of '${elementName}'.`;
if (elementName.indexOf('-') > -1) {
if (elementName.startsWith('ng-')) {
errorMsg +=
`\n1. If '${boundProp.name}' is an Angular directive, then add 'CommonModule' to the '@NgModule.imports' of this component.` +
`\n2. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
} else if (elementName.indexOf('-') > -1) {
errorMsg +=
`\n1. If '${elementName}' is an Angular component and it has '${boundProp.name}' input, then verify that it is part of this module.` +
`\n2. If '${elementName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.` +