I want use '@Input()' string for selector, but I can't, the selector always log undefined, here my examples:
Specific example
/********* compA File *********/
// compA -> html (call compB 3 times, every time keying in the different string in [expName])
<compB [expName]="'dog'">
this is dog //ng-content
</compB>
<compB [expName]="'cat'">
this is cat //ng-content
</compB>
<compB [expName]="'bird'">
this is bird //ng-content
</compB>
// compA -> TS
... there is no need, I type string in the html
/********* compB File(it's a template) *********/
// compB -> html
<div #{{expName}}>
<ng-content></ng-content>
<div>
// compB -> TS
@Input() expName; // when compA using compB, he will type something string to [expName], and compB can read it from @Input.
...
@ViewChild('dog') dog;
@ViewChild('cat') cat;
@ViewChild('bird') bird;
at a lot Input, comA type the dog、cat、bird...to the comB's [expName], so comB use @Input get it, have I look, maybe the [expName] now can be a #cat、#dog、#bird in the html.
ngOnInit(){
console.log( this.dog );
}
now I try to log #dog, and I failed