📜  angular elementref parent - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:34.028000             🧑  作者: Mango

代码示例1
// Inject the element itself:
constructor(private elRef: ElementRef){}

// access the native elements parent:
ngOnInit() {
  console.log(this.elRef.nativeElement.parentElement);
}