STACKBLITZ
ContentChild(ren)
或
ViewChild(ren)
HelloComponent
的局部模板变量
#queryMeFromDirective
比如:
@ViewChild('queryMeFromDirective', {static: true}) myEl: ElementRef
我能在里面用这个得到同样的结果吗
QueryDirective
.
我可以注射宿主
@Host() @Self() @Optional() public helloComponent : HelloComponent
所以我应该以某种方式访问:/。
-
我知道我可以将局部变量赋给指令的输入。
-
我知道我可以在组件内部执行查询,然后从指令访问组件属性。
这个问题是关于查询主机组件视图的
直接