'Vanilla JS Algolia InstantSearch - Parsing array data in template

I have my data stored in an array of objects and I am successfully parsing the first two values in my template. As they are strings, it’s pretty straightforward -

{{#helpers.highlight}}{ "attribute": "traditional" }{{/helpers.highlight}}
{{#helpers.highlight}}{ "attribute": "pinyinDiacritic" }{{/helpers.highlight}}

I’m trying to do the same for an array of data that I have stored. I’ve tried using the same way as before ({ "attribute": "definitions" }) but no data gets returned.

This makes sense as it’s an array and not a string but how do you parse arrays in an instantsearch template?



Solution 1:[1]

I think you can write

{{#array}}{{value}}{{/array}}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tushar Roy