Hi
I am using Angulat material Table. In Header i have Add Button and a dropdown with option Export to excel., csv . I want that dropdown options should be Dynamic. If i want export to pdf it should appear automatically in every component where dropdown is defined..
Thanks.
Jayraj ChhayaPosted Jun 28, 2024, 7:13 AM
To achieve dynamic dropdown options in an Angular Material Table, you can create a shared service to manage the dropdown options centrally. This service can be injected into components where the dropdown is used to fetch the dynamic options.
DropdownServiceand subscribe to the options:addOptionmethod in the service from any component: