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

How to return model from Modal? #34

Open
kahanu opened this issue Jul 28, 2017 · 1 comment
Open

How to return model from Modal? #34

kahanu opened this issue Jul 28, 2017 · 1 comment

Comments

@kahanu
Copy link

kahanu commented Jul 28, 2017

I want to pass a model containing properties of data to the dialog content, and then return the model back with any changes to the data. An example scenario would be the dialog open a form with fields, the user edits the content in the fields, and save the the dialog.

I want my host component to capture that model with all the properties. I would rather not have to create properties for all of the model properties, which could be 20 properties.

Is this possible? If so, how? It's not obvious from your examples.

@xLarry
Copy link

xLarry commented Jul 31, 2017

My workaround might be a little hacky, but here is how I did it:

prompt.component.ts

  1. Line 27: Change the return type of the DialogComponent to <PromptModel, any>
  2. Line 35: Attach your return data to this.result

app.component.ts
3. Line 37-40: Rename the parameter message to something more speaking (e.g. result) and access the data.

Let me know if I missed something.

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

No branches or pull requests

2 participants