Passing data to modal with a reactive form
See original GitHub issueI have a form that I want to use for both posting and editing data. I’m creating the modal using the service and passing the object that needs to be edited in the content.
I’m creating the from in the constructor, but at that time the data from the main component is not available in the modal component, nor is it available in the OnInit
call.
Any ideas on how to make this work?
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Passing data to modal and binding it to a reactive form
I have a modal that has a reactive form with a few inputs and I want to use the same modal for both...
Read more >Reactive forms in angular 13 (CRUD + bootstrap modal + ...
reactiveforms #angular13 #angularformsThis video explains reactive forms in angular 13 also includes below topics1, Reactive Form ...
Read more >Pass Data into Ng-Bootstrap Modal in Angular 8
Pass data in Ng-Bootstrap Modal. In this tutorial, we'll learn how to pass data to a modal by using Ng-Bootstrap in Angular version...
Read more >Reactive Forms with Custom Validations in ngBootstrap Modal
In this post we will cover implementation of bootstrap modal along with angular's reactive forms , custom validations and child-parent ...
Read more >Angular Material 9|8|7 Add Dialog Modal and Pass Data ...
After adding Angular material in our project, we need to import the required modules in the Angular module. we'll use Dialog, Input Field,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK, so misread the the docs, forget my last comment 😄
This is my parent component function call that creates the modal:
The constructor in the Modal component:
And the OnInit function:
In the console I have
Got it to work thanks to your hack, but I wouldn’t close this issue yet because this should work as per the documentation.
Hi, @dushkostanoeski I think, in your case, data not yet actually bound to bsModalRef. Try to wrap data binding with time out. It looks like a hack, but should work.