Reset dialog

I am opening a dialog app-new-backlog component  from parent window on Add button click
When i click the Add button click next time it is retaining OLD values
How do i reset the values in the component (init is not firing every time) dialog modal?

And how to pass any data to modal from parent?

  <ejs-dialog id='dialog' #ejDialog isModal='true' [visible]='visible' header='Add Task' width='500px'>
                <app-new-backlog>app-new-backlog>
            ejs-dialog>



 show(){
    console.log('showwww');
    this.ejDialog.show();
  }

  hide(){
    console.log('hideee');
    this.ejDialog.hide();
  }

1 Reply

RK Revanth Krishnan Syncfusion Team January 5, 2021 07:36 AM UTC

Hi Vin, 
 
 
Greetings from Syncfusion support. 
 
 
We have validated your query “When opening the dialog, the dialog retains the old value, how to reset the value of the dialog?”. 
 
 
The value of the dialog can be changed using the `content` property, where the content can be changed dynamically before the dialog open. We have prepared a sample for your reference, 
 
Code Snippet 
 
Here the value selected in the dropdown list is displayed in the dialog dynamically. 
public currentData: string; 
 
onSelect(args: SelectEventArgs) { 
    this.currentData = (args.itemData as any).Name; 
} 
 
public modalBtnClick = (): void => { 
    this.content = this.currentData; 
    this.modalDialog.show(); 
}; 
 
 
Note: The `ngOnInit` will be triggered only once when initialization of the component. 
 
 
Please check the above code snippet and the sample and let us know if it satisfies your requirement. 
 
Regards, 
Revanth 


Loader.
Up arrow icon