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

@ -380,6 +380,16 @@ Can't bind to 'invalidProp' since it isn't a known property of 'my-component'.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("<my-component [ERROR ->][invalidProp]="bar"></my-component>"): TestComp@0:14`);
});
it('should throw error when binding to an unknown property of ng-container', () => {
expect(() => parse('<ng-container [invalidProp]="bar"></ng-container>', []))
.toThrowError(
`Template parse errors:
Can't bind to 'invalidProp' since it isn't a known property of 'ng-container'.
1. If 'invalidProp' is an Angular directive, then add 'CommonModule' to the '@NgModule.imports' of this component.
2. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.` +
` ("<ng-container [ERROR ->][invalidProp]="bar"></ng-container>"): TestComp@0:14`);
});
it('should throw error when binding to an unknown element w/o bindings', () => {
expect(() => parse('<unknown></unknown>', [])).toThrowError(`Template parse errors:
'unknown' is not a known element: