How do I access an object attribute based on a variable in an Angular template? I have an object that has an attribute based on a user selection, so how do I tell the Angular template to get that value? For example, the user chooses q26 and I access the object like this:
{{ item.q26 }}
it woks no problem. But if a user chooses q28, it obviously wouldn't work. I can successfully pass the value the user chooses to the template but how do I get Angular to read that variable as an object attribute. I know this doesn't work but the idea would be:
{{ item }}.{{ user_selection }}
Thanks!
{{ item[user_selection] }}
just like with objects.