We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How can I add multiple richtexteditor dynamic?

Hello Team,

When I add Multiple richtexteditor dynamic so how can I declare viewChild in ts file ? If I remove viewChild (#imgRte)  in html file so it will give an error.

Please Help me.


1 Reply

VJ Vinitha Jeyakumar Syncfusion Team November 17, 2022 05:16 AM

Hi Lee,

We can achieve your requirement by using ngFor condition. For every button click we pushed the id value into an array and then rendered the RichTextEditor component. based on that id value, you can get the instance of each Rich Text Editor.

Code snippet:
<div *ngFor="let id of countArray">
    <ejs-richtexteditor id="{{ id }}">
      <ng-template #valueTemplate>
          The Rich Text Editor component is a WYSIWYG ("what you see is what you
          get") editor that provides the best user experience to create and
          update the content. Users can format their content using standard
          toolbar commands.
    <br />

 public BtnClick() {
    var id = 'default_rte' + this.count;

  public ValueBtnClick() {
    var rteInstance = (document.getElementById('default_rte1'as any)


Live Chat Icon For mobile
Up arrow icon