Closed jw-miaem closed 6 years ago
Handlesbars doesn't accept literal array syntax in the templates, so you'll need to put the array of properties on the data context, then pass that variable in:
const data = {
props: ['progressTitle', 'pageTitle'],
health: {
signup: {
company-registration: {
progressTitle: 'Foo',
pageTitle: 'Page foo'
}
}
}
};
Handlebars.compile('{{#pick props health.signup.company-registration}}{{/pick}}')(data);
I hope this helps.
Thanks for help
Hi, I cant seem to get pick to work with array of values. This is what I'm trying and possibly have incorrect format: {{#pick ['progressTitle','pageTitle'] health.signup.company-registration}}