Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NgUpgrade "Only selectors matching element names are supported" #7026

Closed
Zizzamia opened this issue Feb 11, 2016 · 6 comments
Closed

NgUpgrade "Only selectors matching element names are supported" #7026

Zizzamia opened this issue Feb 11, 2016 · 6 comments

Comments

@Zizzamia
Copy link
Contributor

I start doing upgrade and I had this error at getComponentInfo @ metadata.ts:30

Uncaught Error: Only selectors matching element names are supported, got: [navbar-info]

js

var navbarInfo = ng.core.Component({
  selector: '[navbar-info]',
  template: '<h1>Hello Navbar Info!</h1>'
}).Class({
  constructor: function() {
  }
});

var adapter = new ng.upgrade.UpgradeAdapter();
angular.module('Plan.components.navbarInfo', [])
.directive('navbarInfo', adapter.downgradeNg2Component(navbarInfo));

html

<div navbar-info class="col-xs-9 navbar-info"></div>

Thanks

@ronnievdv
Copy link

Getting the same error for Attribute Directive

js

@Directive({
    selector: '[contextMenu]'
})

export class ContextMenuDirective {
}

html
<div contextMenu></div>

error
Only selectors matching element names are supported, got: [contextMenu]

@marcalj
Copy link

marcalj commented Jun 1, 2016

Bad experience while upgrading to ng2 :(

@mhevery
Copy link
Contributor

mhevery commented Jun 1, 2016

Working as intended.

The reason for this is that each element can only be owned by one framework. Attribute selectors would allow both frameworks to own the elements.

@mhevery mhevery closed this as completed Jun 1, 2016
@DanielSchuech
Copy link

If you want to up- and downgrade attribute directives you can try ngAdapter
It extends the angular upgrade with the support of attribute directives (with another approach).

@marcalj
Copy link

marcalj commented Jun 4, 2016

Hi, I misunderstood the issue. It's possible to use ng2 attribute components inside a ng2 component. The problem is mixing it with ng1 component. So ok for me! Thanks!

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants