fix(core): improve error when multiple components match the same element
Closes #7067
This commit is contained in:
@ -644,7 +644,11 @@ class TemplateParseVisitor implements html.Visitor {
|
||||
private _assertOnlyOneComponent(directives: DirectiveAst[], sourceSpan: ParseSourceSpan) {
|
||||
const componentTypeNames = this._findComponentDirectiveNames(directives);
|
||||
if (componentTypeNames.length > 1) {
|
||||
this._reportError(`More than one component: ${componentTypeNames.join(',')}`, sourceSpan);
|
||||
this._reportError(
|
||||
`More than one component matched on this element.\n` +
|
||||
`Make sure that only one component's selector can match a given element.\n` +
|
||||
`Conflicting components: ${componentTypeNames.join(',')}`,
|
||||
sourceSpan);
|
||||
}
|
||||
}
|
||||
|
||||
@ -831,4 +835,4 @@ const NON_BINDABLE_VISITOR = new NonBindableVisitor();
|
||||
|
||||
function _isEmptyTextNode(node: html.Node): boolean {
|
||||
return node instanceof html.Text && node.value.trim().length == 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user