angular - Angular 从路由器出口组件获取 ElementRef
问题描述
要从路由器插座获取组件实例,我可以使用
<router-outlet (activate)="onRouterActivate($event)"></router-outlet>
我可以在我的方法中捕捉到这一点:
public onRouterActivate(componentRef) {
this.componentRef = componentRef;
}
但是我如何获得底层componentRef的nativeElement
/ ?ElementRef
该nativeElement
属性似乎不存在于通过的内容(activate)
解决方案
推荐阅读
- serialization - Fabric.js:如何序列化/反序列化一些全局数据?如何扩展画布对象?
- java - 如何将两组中唯一的一组点存储到新的int set java(对象)中?
- networking - nmap 避免随机结果(提高精度)
- reactjs - 如何用酶模拟点击事件?
- ios - 如何在 Swift 中计算和比较日期?
- javascript - 如何使用 javascript 在邮递员中使用 ajv.addFormat()
- .net - StackExchange.Redis.StrongName.Core 和 StackExchange.Redis.StrongName 有什么区别
- python - 为什么我在 pygame 中的拍摄代码不起作用?
- javascript - 从表格中选择一个单元格并为其赋予唯一的类
- zurb-foundation - 使用 flex 网格(不是 xy 网格)时,基础对齐列