-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat(modal): pass custom data to the hide() method in Modal #2330
Comments
There's no such possibility for now. Can you explain why do you need it? |
Yes. Let's imagine that we have a next snippet of code: <button (click)="onDelete()">Delete</button> class Project {
onDelete() {
this.dynamicModal.show();
// I want to get data array here from the method hide()
}
} In modal component, I want to transform some data and return this value to the class Project class MyModalComponent {
public data = [];
first() {
this.dynamicModal.hide(data.filter(x => isPositive(x)));
}
} Does it clear? |
I also need this. I do some work in the modal and when it closes I need to refresh the data in the component that called the modal. But I need to know when the user closed or finish the task and are done. But I just solved the problem passing a function to the modal. and Call it with parameters when I am done, and closing the modal in the parent component @CornCodeCorp check it out
and in the modal:
|
You can declare your modal in the same template as your component and share everything. |
My idea is to create one general ModalComponent in the root of application and call this component via ModalService in any places. Also, ModalService accepts one of my components for loading dynamically in the ModalComponent. |
You can set And then, |
@faiz2rock Thank you. I found the same solution. |
+++ for this |
Buy the way, you can do the same flow as in native |
I need this for the |
I need that option too. Best solution is
reason should be moved somewhere else in my opinion |
How can I return data from modal if I use only component-based show() in Service? Update: From modal component in close() just add modalService.setDismissReason(any) before hide(): this.bsModalService.setDismissReason(JSON.stringify{
mode: 'closed',
data: [ 1, 2, 3 ]
}));
this.myModal.hide(); |
Also unable to reliably get return value from the actual modal - not enough to generally use the service to listen for any modal to close as there may be many. How do i find out if my specific modal has closed with f. eks ESC? |
Why isn't modalService.setDismissReason mentioned anywhere in the modal API documentation? Also, I would like to contribute to the documentation can you tell me where is the documentation located in this repo. |
I solved the problem this way Service
Modal Component
Component that shows modal and needs receive some data after modal is hidden
|
Could you please explain how to pass custom data to the hide() method
this.dynamicModal.hide(data);
The text was updated successfully, but these errors were encountered: