Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set IModalOption.data and send it back to parent #24

Closed
iamnilay3 opened this issue May 23, 2018 · 1 comment
Closed

Set IModalOption.data and send it back to parent #24

iamnilay3 opened this issue May 23, 2018 · 1 comment

Comments

@iamnilay3
Copy link

Hi,

how could I set the IModalOption.data from a server call in async way and send it back from modal to parent.

@meeroslav
Copy link
Collaborator

meeroslav commented Jun 11, 2018

If you are using mutable structure you could do this.

myMutableObject = {
  innerData: 'some value'
};

this.modalService.openDialog(this.viewRef, {
    title: 'Some title',
    childComponent: SomeComponent,
    data: myMutableObject
});

And then have in your SomeComponent (modal dialog component) piece of code like this:

this.myService.getSomeData(data => {
   // if you only mutate the inner property your parent component will change as well
   this.data.innerData = data;
});

However, I would not suggest to do this. Instead I would do let child modal component just trigger async method on parent component. Check #21 and #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants