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.
Use brackets in conjunction with dots, without quotes:
{{#each records}}
{{this.[Record ID]}}
{{/each}}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.