fuzzybabybunny
fuzzybabybunny

Reputation: 5254

How Do I Nest Meteor Spacebars Templates?

I'm using a package called AutoForm.

{{> afQuickField name="propertyInfo.zipcode" placeholder="XXXXX" class="form-control track-order-change"}}

It basically renders a label and input element.

I have a session variable:

Session.set("zipcode", //something dynamic);

I have a registered helper:

Handlebars.registerHelper("zipcode", function(){
  return Session.get("zipcode");
})

I would like something like this to work:

{{> afQuickField name="propertyInfo.zipcode" value="{{zipcode}}" placeholder="XXXXX" class="form-control track-order-change"}}

Upvotes: 0

Views: 61

Answers (1)

benstr
benstr

Reputation: 652

First fix you global helper to read:

Template.registerHelper("zipcodeHelper", function(){
  return Session.get("zipcode");
})

Then fix the afQuickField a little:

{{> afQuickField value=zipcodeHelper class="form-control track-order-change"}}

Refer to this GH issue: https://github.com/aldeed/meteor-autoform/issues/210

Upvotes: 1

Related Questions