Solvedangular [RC6][REGRESSION][ngUpgrade] Error: Only selectors matching element names are supported
✔️Accepted Answer
Regardless if it is antipattern or not it should not be upgrade
making the check. I will have a look and should have a PR shortly.
Other Answers:
Looking at the code, this issue seems to have been introduced by this commit
4a740f2
._bootstrapModuleWithZone( DynamicNgUpgradeModule, undefined, ngZone, (componentFactories: ComponentFactory<any>[]) => { componentFactories.forEach((componentFactory) => { componentFactoryRefMap[getComponentInfo(componentFactory.componentType) .selector] = componentFactory; }); })
_bootstrapModuleWithZone is now called with a callback which is, according to the comment left in the code, an ugly internal api hack :)
// ugly internal api hack: generate host component factories for all declared components and // pass the factories into the callback - this is used by UpdateAdapter to get hold of all // factories.
the fix is in 2.0.1
Current behaviour
With RC6 using ngUpgrade we cannot create directives like this:
@Component({
selector: '[alertManagerRow]',
template: `
<td>foo</td>
<td>bar</td>
`
})
Use case:
<table>
<thead>
<tr>
<th>1st column</th>
<th>2nd column</th>
</tr>
</thead>
<tbody>
<tr alertManagerRow [number]="777"></tr>
<tr alertManagerRow [number]="333"></tr>
</tbody>
</table>
Error: zone.js:461 Unhandled Promise rejection: Only selectors matching element names are supported, got: [alertManagerRow] ; Zone: ; Task: Promise.then ; Value: Error: Only selectors matching element names are supported, got: [alertManagerRow]
With RC5 was working perfectly.
Expected behaviour
Rendering of directive without any error. As it works without using ngUpgrade. It was working in RC5.
Steps to reproduce
Just see console error in this plunkr: http://plnkr.co/edit/ImXKSq0EOM80kVtaJVpQ?p=preview
I'm submitting a ... (check one with "x")
Current behavior
With RC5 it's working fine.
With RC6: Error: Only selectors matching element names are supported, got: [alertManagerRow].
Reproduction of the problem
http://plnkr.co/edit/PvVWdDG5RfN7ZzVn0gUu?p=preview
Please provide a way to implement it, as you can see in the plunkr, it cannot be used as a non-attribute definition.
Please tell us about your environment: