How to Find Children Element in @ViewChild Angular2?

后端 未结 1 1254
清歌不尽
清歌不尽 2021-01-05 12:28
import { Component, ViewChild } from \'@angular/core\';

@Component({
  selector: \'my-app\',
  template: `
    

para 1

相关标签:
1条回答
  • 2021-01-05 12:37

    You can try the following to get array of p elements:

    Array.from(this.myDiv.nativeElement.children).filter(tag => tag.tagName === 'P')
    
    0 讨论(0)
提交回复
热议问题