Template7 object properties with spaces


#1

I am using template7 template engine and having a problem when it comes to an object that has spaces as property names. Usually in js they can be accessed by using brackets myObject[‘property with spaces’]. In the case of template7 variables in my html template, I cannot seem to access these properties this way.

example: {{#if data.actions[‘CONFIRM CANCEL’]}}

my object: {data: “actions”:{“CONFIRM CANCEL”:“49”}}

Looking for any suggestions on how i could select this property within a template7 expression?


#2

Although I’m quitte sure property names with spaces are not a best practise :wink: You could try if it works inside js_if blocks:

{{#js_if "this.data.actions['CONFIRM CANCEL'] == 49"}}
  Your content
{{/js_if}}