[question] modal outside component How can I pass an entire row of data instead of just an ID?
Closed this issue · 11 comments
I want to pass all the data of the selected row to a child component for editing, please guide me on how to do this, thank you very much. image https://i.imgur.com/rovwAMR.png
@khanhtungmtp Click on the selected data in the table and edit it through modal. You can refer to the component account.component.ts
and in account-modal.component.ts,you can use nzModalData to get it
Which library module does the show function belong to? I only see the create method.
code here https://yamcode.com/formcomponentts and https://yamcode.com/maincomponentts-and-maincomponenthtml
@khanhtungmtp Click on the selected data in the table and edit it through modal. You can refer to the component account.component.ts
and in account-modal.component.ts,you can use nzModalData to get it
Do not use the modals provided by Zorro, please use the modals I provided. Please refer to the file in my project path of src/app/pages/system/account/account. component. ts as a reference, and track the source of the modalService attribute. You can refer to the content of the add() and edit() methods to call modal.
The directory path of the called module is src/app/widget/biz widget/system/account module
In this directory file, the nzModalData attribute in the account modal. component. ts file can be called from the following location, for example:
Transferred by the res here
@khanhtungmtp You need to refer to the file src/app/widget/biz widget/system/account modal/account modal. service. ts for the show function to create your own file
@khanhtungmtp You need to refer to the file src/app/widget/biz widget/system/account modal/account modal. service. ts for the show function to create your own file
Ah, I want to pre-fetch the data on the main page and carry it over to the form page directly. As for having to get the API again, I've already passed the ID to the form and got the API on the form side. I'd like to use this method to reduce the calls to the API for getting details.
The first method:
The second method:
change file src/app/shared/components/ant-table/ant-table.component.html
and
I think both approaches are bad. Other users may modify the table data, causing the data you get to be lagging data. I think you should call the interface to get the data details when fetching the data, and then perform subsequent operations.
@khanhtungmtp My latest code has expanded this ability, please refer to
thanks
If you have any questions, please reopen this issue