Hi
I have below code . I want when user Clicks on Add Modal popup should open which has been defined in a Child component.
Dynamic Table is a separate component
-
Product Form
Product Name
Product Description
Product Image
Thanks
Naimish MakwanaPosted Jul 9, 2024, 7:39 AM
From your code, it seems like you’re missing the click event handler on the “Add” button that should trigger the modal to open. You need to add a
(click)event to the button that will call theopenDialogfunction.Here’s how you can do it:
In your TypeScript file, you should have a method
openDialogthat opens the modal. If you’re using Angular Material, you can use theMatDialogservice to open the modal. Here’s an example:In this example,
DialogComponentis the component that contains your form. You would replace this with the component that contains your form.Remember to import
MatDialogModulein your module file.Thanks