Skip to content
Advertisement

Filter array of objects by using property value in dropdown – Angular template

I’m trying to filter array of objects by using property value and display filter results in dropdown. This is my JSON structure:

JavaScript

Here I want to display names in dropdown where subject is maths. I can able to do filter in ts file and can able to display in dropdown, but I would like to do filter part in template it self. For now I’m displaying all names with below code.

JavaScript

So if I want to display only subject of maths, how can i filter in template file.

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement