I would like to have a dynamic parameter based on a dropdown list:
So this is my code:
<input
#file
type="file"
(change)="functionTest($event.target)"/>
<button
nz-button
nz-dropdown
[nzDropdownMenu]="menu">
Import
</button>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu>
<li nz-menu-item (click)="file.click()">
TEST1
</li>
<li nz-menu-item (click)="file.click()">
TEST2
</li> ....
So I call functionTest
with the $event.target (file that I choose ) but I want to add an argument depends on which button I clicked, For examples if I click on Test1
I want to call
functionTest($event.target, 'Test1')
What is the best way for doing this, without using or getting element directly from the DOM because direct manipulation of the DOM can lead to security, performance, and maintainability issues.
I could add an other function in the (click) but I'm not sure it's the best way for this
Is it possible or do I need to stop using nz-dropdown-menu? I'm using TypeScript
Thanks in advance