1

I have an Angular HTML template with repeating rows of data (an NGFOR) and on each row, I want to have a select, allowing a user to pick one of a number of actions. I can see that I can get the value of the selected action, but I need to get one of the properties of the row, which is a key value. What's the best way to do this in Angular?

Tim Almond
  • 12,088
  • 10
  • 40
  • 50

1 Answers1

0

Depending on the select control, you can bind to the selected change value event and send the id and the item property in your event to your component.ts file.

Check https://material.angular.io/components/select/api and the selectionChange output.

Otherwise you can send just the id and filter your array items to get the property.

Check Angular Mat Select Multiple selectionchange finding which option was changed for a good example on material select.

Athanasios Kataras
  • 25,191
  • 4
  • 32
  • 61