有没有一种方法可以选择元素并对元素进行必要的操作?
您可以通过将Element注入到组件中来通过ElementRef处理DOM元素’s constructor:
constructor(myElement: ElementRef) { ... }
pre
code