I am using ng-bootstrap' modal and got stuck with a problem.
Situation:- I have a form component that I am showing in a modal. Now, I want to close the modal once the user submits the form and backend confirms the success.
problem:- As guided here, I don't have a reference of the modal in child component to close it. please suggest a way. Thanks.
- Duplicate of this SO question.Jeroen Heier– Jeroen Heier2018-06-25 03:56:36 +00:00Commented Jun 25, 2018 at 3:56
Add a comment |
1 Answer
You could pass the modal reference to it using a child input property.
<child-component [parentRef]="ref"> And then in your child component you'll have to define something like:
@Input() ref; Please take a look at the Angular documentation here.