fix(compiler): throw when a component defines both template and templateUrl (#15572)

Closes #15566
This commit is contained in:
Dzmitry Shylovich
2017-03-29 20:26:48 +03:00
committed by Victor Berchet
parent d58a242fe7
commit 9c77a7cdaf
2 changed files with 14 additions and 0 deletions

View File

@ -65,6 +65,10 @@ export class DirectiveNormalizer {
let normalizedTemplateSync: CompileTemplateMetadata = null;
let normalizedTemplateAsync: Promise<CompileTemplateMetadata>;
if (prenormData.template != null) {
if (prenormData.templateUrl != null) {
throw syntaxError(
`'${stringify(prenormData.componentType)}' component cannot define both template and templateUrl`);
}
if (typeof prenormData.template !== 'string') {
throw syntaxError(
`The template specified for component ${stringify(prenormData.componentType)} is not a string`);