Questions tagged [spacebars]

Spacebars is a Meteor template language inspired by Handlebars. It shares some of the spirit and syntax of Handlebars, but it has been tailored to produce reactive Meteor templates when compiled.

Spacebars is the template language used by the blaze layout engine that is used in Meteor 0.8.

436 questions
30
votes
6 answers

How can I get the index of an array in a Meteor template each loop?

Say I have an object, someObject: { foo: "apple", myArray: ["abc", "def"] } And a template helper that looks like this (and works fine): getArray: function(){ var self = this; self.myArray = self.myArray || []; return…
Oliver Lloyd
  • 4,936
  • 7
  • 33
  • 55
22
votes
8 answers

Meteor: Access Template Helper (or variable) from another helper

How can I reference a template helper from another one? For example... Template.XXX.helpers({ reusableHelper: function() { return this.field1 * 25 / 100; //or some other result }, anotherHelper: function() { if…
Habib
  • 279
  • 1
  • 2
  • 9
19
votes
3 answers

Check for equality in Spacebars?

I am trying to do what I think should be a very simple task, but have been failing to do so in the past hour. I want to select a select option by default if the user property matches the value.