Angular 2 Root Component - Dynamic Selector

2019-09-14 17:05发布

问题:

The following comment was made on a different question.

What I know is planned is to allow to pass. a custom selector for the root component.

Is this feature available in Angular 2.x? Unfortunately, dynamic compnonent selector brings up a slew of information not related to this specific use case.

I know the following is not possible, but it best illustrates what I want:

import { Component, Inject } from '@angular/core';
@Component({
    selector: Inject('DynamicSelector')
    ...       
})
export class AppComponent {
    ...
}

Anyone know of a clean technique to accomplish the above?

回答1:

There is a recent pull request but it wasn't merged yet

  • https://github.com/angular/angular/pull/14750

See also

  • https://github.com/angular/angular/issues/7136
  • https://github.com/angular/angular/issues/13035


标签: angular