unlayer / angular-email-editor

Drag-n-Drop Email Editor Component for Angular
https://unlayer.com
MIT License
203 stars 166 forks source link

email-editor support under the NgbModal? #91

Open chaklasiyanikunj opened 2 years ago

chaklasiyanikunj commented 2 years ago

I tried to Put an email editor inside the NgbModal. But, it gives an editor undefined.

<button class="btn btn-primary" (click)="openDialog(openModal)">>Open Dialog</button>

<ng-template #openModal let-modal>
    <div class="modal-header bg-white">       
    </div>
    <div class="modal-body bg-white pl-0 pr-0 pt-0 pb-0">
           <email-editor #emailEditor (loaded)="editorLoaded()" (ready)="editorReady()"></email-editor>
    </div>
</ng-template>

openDialog() {
 this.modalService.open(targetModal, {
        size: 'md',
        backdrop: true
      });
}

public editorLoaded() {
}

public editorReady() {
     this.emailEditor?.editor?.loadDesign();
}

public exportHtml() {
      //Here it gives the error
     //core.mjs:6494 ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'editor')
     //TypeError: Cannot read properties of undefined (reading 'editor')

      this.emailEditor.editor.exportHtml((data) => {
      });

 }

Does anyone know if this works with NgbModal or not?