Is there a way in Angular 2 to retrieve the class name or reference of a component based on its selector name?
@Component({
selector: 'selector-1',
template: '<h1>Hello</h1>',
})
export class Component1 {}
@Component({
selector: 'selector-2',
template: '<h1>Hello</h1>',
})
export class Component2 {}
For example, can we access the class name of Component1 from within Component2 using the selector "selector-1"?
Example:
getComponentName(selectorName) {
// return component name
}
getComponentName('selector-1');
Any assistance would be greatly appreciated.