要获取多个PrimeNG编辑器的实例,可以使用ViewChild装饰器来引用每个编辑器的实例。以下是一个示例:
首先,确保已经在NgModule中导入了EditorModule:
import {EditorModule} from 'primeng/editor';
然后,在组件类中使用ViewChild装饰器来引用每个编辑器的实例。给每个编辑器添加一个模板引用变量:
在组件类中,使用ViewChild装饰器来获取每个编辑器的实例:
import {Component, ViewChild} from '@angular/core';
import {Editor} from 'primeng/editor';
@Component({
  selector: 'app-editor',
  template: `
    现在,您可以通过this.editor1和this.editor2访问每个编辑器的实例,并对其进行操作。