When creating a string from multiple inputs, I have a requirement to include the name of the input element as the second parameter in a function.
<input [(ngModel)]="programSearched" name="programSearched"(ngModelChange)="stringBuilderOnChangeMaker(programSearched,??programSearched.name??)" </input>
I need to distinguish between different inputs triggering the same onchange action, hence passing the name of the calling input to my method is essential.
stringBuilderOnChangeMaker(value, type) {
if (type == X) {
...
} else if (type == Y) {
...
}
}
One option is to send a generic value like "program" or 1 as the second parameter, but it would be more elegant and informative to pass the id or name of the element instead.