[FIXED] PrimeNG Dynamic Dialog instance/ content of component

Issue

I have problem with dynamic dialog in PrimeNg.

Is there any option to handle other actions on a dialog besides close?

For example, in Kendo-UI dialog example I can define content.instance of the component and I can access the fields of the component instance opened as dialog.

  const ref = this.dialogService.open(ResourceComponent, {
        data: {
            logicFormGroup: this.formGroup,
            resources: this.resources$
        }, width: '700px'
    });

    ref.onClose.subscribe((back: ResourceModel) => {
        console.log(back);
    });

   ref.addPersonEmitter.sub(....)

   in component ResourceComponent
   @Output() addPersonEmitter = new EventEmitter();

Solution

i solve it by passing eventemitter to dialog data and subscribed to that refernce

in parent

    oneventFire : EventEmitter<number> = new EventEmitter<number>();
this.dialogService.open(MyPopupComponent,
      {data: {  oneventFire : this.oneventFire },

in child

 if (this.config && this.config.data) { 
      this.oneventFire = this.config.data.oneventFire ;
    }

so then you can subscribe in parent and emit in children

Answered By – Abdullah Tahan

Answer Checked By – Mildred Charles (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published