Reputation: 351
In a handlebars view - is there a way to reference an objects key that has a space in it? The key is "Record Number" in the object, but I can't seem to be able to reference it in the view. For instance - I have the following code in the view:
{{#each records}}
{{this.'Record ID'}}
{{/each}}
The array "records" from the controller:
records = [
{
'Record ID':3
},
{
'Record ID':3
}
];
The error I am getting:
Expecting 'ID', got 'STRING'
I have also tried "this['Record Number']" with the same error.
Upvotes: 0
Views: 69
Reputation: 127
Use brackets in conjunction with dots, without quotes:
{{#each records}}
{{this.[Record ID]}}
{{/each}}
Upvotes: 1