DevCloudFE/ng-devui

🐛 [Bug]: Dialog 获取不到 modalContentInstance

bmbper opened this issue · 1 comments

Version

14.1.0

Angular Version

15.0.3

Link to minimal reproduction

html:

      <bmbp-tree-select [treeSelectConfig]="menuTreeSelect" [modalInstance]="modalInstance"
                        [modalContentInstance]="modalContentInstance"></bmbp-tree-select>
  </ng-template>

ts:

 const selectModal = this.dialog.open({
      id: 'bmbp-change-parent-menu',
      width: '360px',
      maxHeight: '300px',
      title: '选择菜单',
      contentTemplate: this.parentMenuDialog,
      backdropCloseable: true,
      buttons: [
        {
          cssClass: 'primary',
          text: '确定',
          disabled: false,
          handler: ($event: Event) => {
            debugger;
            let menuVo = selectModal.modalContentInstance.getSelectData();
            this.bmbp.info('选中的菜单记录:' + menuVo.menuId);
            selectModal.modalInstance.hide();
          },
        },
        {
          id: 'btn-cancel',
          cssClass: 'common',
          text: '取消',
          handler: ($event: Event) => {
            selectModal.modalContentInstance.clear();
            selectModal.modalInstance.hide();
          },
        },
      ],
      onClose: (ev: any) => {},
    });
    console.log(selectModal.modalContentInstance);

Step to reproduce

selectModal.modalContentInstance 为null

What is expected

No response

What is actually happening

No response

Any additional comments (optional)

No response

请参考此demo获取传入contentTemplate方式下的modalContentInstance https://devui.design/components/zh-cn/modal/demo#template-content