Is it possible to get a property of an object having the key being another property?
Handlebars data:
{
person: {
firstName: 'John',
lastName: 'Doe'
},
propertyToGetFromPerson: 'firstName'
}
Then in the template itself I would like to get firstName
of person but by using the propertyToGetFromPerson
property in stead of the literal 'firstName'.
In JavaScript this would be: person[propertyToGetFromPerson]
So I am searching for the equivalent in handlebars if there is one.
I am looking for an answer without using helpers, if there is no answer I can write a helper.