Strange behavior when using #with, lookup subexpression, and nested data
This is, in my opinion, a hard question to describe but I will try to do my best. For context, I was using this example from the handlebars.js docs. I have since realized that these are 2 different projects, so I understand there may be some differences. However, I got close enough that it makes me question if I'm doing something wrong.
I have a handlebars template that looks like this:
{{#each actions[1].loop}}
{{#with (lookup actions[0].response.results @index)}}
{{ this }}
{{/with}}
{{/each}}"
Key points:
- Using a
#withhelper within a loop, and using the@indexdata variable to access the same index, in a different object. Where actions 0 and 1 look like:
actions[0]:
{ ...
"climate": "arid",
"name": "Tatooine",
"url": "https://swapi.co/api/planets/1/",
...
}
actions[1]:
{ ...
"hair_color": "blond",
"homeworld": "https://swapi.co/api/planets/1/",
"name": "Luke Skywalker",
"url": "https://swapi.co/api/people/1/",
...
}
- This template WORKS—it prints the object like so:
{ name="Luke Skywalker", ...}Note the strange "=" which isn't valid JSON and for some reason replaces the ":" character when compiling. I haven't figured this out and I can't tell if this is a big deal or not. But what stands out to me is that I'm correctly accessing the object I expect to access.
Problem:
If I try to access the name property, which I am certain exists—I get empty spaces as if it cannot find that property.
I've also tried using a nested #with inside the first #with in order to change the context again. To no avail. I've also tried using pipes to "name" the context and access it like "person.name"—nothing. Lastly, I've tried just accessing {{name}} itself, but nothing.
Am I doing something wrong here? I can plainly see that this is the object I want with the property I want, but for some reason I can't access any sub-properties on this.
Please let me know if I haven't provided enough contextual information or if I can clarify.
Thanks in advance for any and all help!