Replace static json data in the handlebars

I'm doing some maintenance on a project I haven't worked with before that uses .hbs files for templating and a static json file for initial data. The javascript appears to be vanilla (no backbone.js, Angular, etc.) Is there a "correct" way of ov

Handlebars: Return of the hash of the assistant

Can i return hash from Handlebars helper? I tried this: In my view: initialize: -> super this.hash = {key1: 'test1', key2: 'test2'} Handlebars.registerHelper 'show', => return this.hash In template: {{show.key1}} What am i doing wrong? Thanks!Handle

Emberjs increment in the template

I feel like I may be doing to much for a simple problem. If index = 0, how do I increment index in a template. Ideally, I would like to do something like this. {{index+1}} From what I understand the solution is to write a helper function like the fol

Avoid model code redundancy

I'm mostly a beginner with both web development and javascript/nodejs/expressjs and I've been facing a certain problem that has been bothering me for months which i can't find a solution that isn't neither too complex or too messy; in the view i have

HandlebarsJS How to get the last element of the array

I want to fetch the last item of my JSON file. So I took a look at Getting the last element from a JSON array in a Handlebars template and tried to implement it. So far it gives me the number of the last entry but I need the options as well but dont

Ember bind-attr className component does not change

I'm trying to do something very simple here and I couldn't make it work so far. It's probably me doing silly things. You click in the circle to turn on and off a post. You can see that the alert message is coming right, the parameter is being updated

Call the Javascript function from the handlebars

How can I call a Javascript function from inside a handlebar script ? Reason: I wasn't able to break the {{#each}} from inside handlebars. So I need to pass it to Javascript to do the logic.You can do that with helpers; Handlebars.registerHelper("pri

Insert html into a handlebar model without escaping

Is there a way to insert a string with html tags into a handlebars template without getting the tags escaped in the outcoming string? template.js: <p>{{content}}</p> use the template HBS.template({content: "<i>test</i> 123&quo

The Meteor model function does not make

I am trying to make a template render something on the client; I think I tried everything possible (apart from the correct thing apparently). Html: <head> <title>Groups</title> </head> <body> {{loginButtons}} {{>TplGroups}

LinkTo does not work after updating the ember

After updating app packages (Ember from rc6 to 1.0.0, handlebars from rc4 to 1.0.0 and jquery from 1.9.1 to 2.0.3) all my linkTo helpers stopped to work; if i click on a link i get this warning: This link-to is in an inactive loading state because at

How to use handlebars.js to fill cells in rows

I'm trying out ember.js/handlebars.js for the first time, and although it's very straightforward, I have a simple use case that I can't figure out. With the following data: var columns = ['col2', 'col3'], rows = [{ col1: 1, col2: 2, col3: 3 }, { col1

The latest EmberJS does not recognize the latest handlebars

When I install both the latest EmberJS (1.0.0-rc.3) and the latest Handlebars (1.0.0-rc.4), I get an error in console when I visit the page: Uncaught Error: assertion failed: Ember Handlebars requires Handlebars 1.0.0-rc.3 or greater. Include a SCRIP

Attribute link in view based on 2 separate data parts

In the controller of a view within my Ember.js application, I have got an array of Travel types and another value with the current user's travel preferences. Within the view, I need to add a CSS class to an element based on if the current travel type

Handlebars js editor.

Lately I have started to explore Ember.js, from their site I understood that there is a good synergy between Ember and Handlebars language. I wondered if there is any editor (plugin) that can help me with handlebars auto-completion and coloring.If yo

pre-compile javascript templates

After reading What are the differences between Mustache.js and Handlebars.js? I was puzzled with a question: What does pre-compiling of javascript templates means? Previously I was using a simple client-side caching, which was working something like

Does handlebars.js replace newline characters with & lt; br?

Trying to use handlebars.js for templating but the library seems to ignore newlines. What is the correct way to deal with newlines? Should they be replaced manually after the templating action?It doesn't do so automatically, but using the helpers fea

Passing variables through partial handlebars

I'm currently dealing with handlebars.js in an express.js application. To keep things modular, I split all my templates in partials. My problem: I couldn't find a way to pass variables through an partial invocation. Let's say I have a partial which l

Ember.js handlebars if, else statement

I'm hoping someone can explain what I'm doing wrong here. I'm using Ember.js with handlebars templates, I've tried a number of ways to get handlebars #if else working for me but it always returns both the contents of if and else.. Here's the code I'm

Relationship between HandleBar js and Mustache js

i'm very new to Handlebar js. In every article about the HandleBar js there is a word called (mustache js). So, 1. What is the relation between Handllebar js and Mustache js? 2. Is it necessary to read mustache js before handlebar js? 3. What s advan

Conditional Partials in Handlebars

I have the following data that I am trying to feed into a Handlebar template { "set-group": [ { "label": "Source Data", "type": "select", "options": [ { "value": "Default Selection

Simple way to create a grid with Handlebars.js?

I'm attempting to generate a grid of divs five elements wide from the objects in this array: [{n:'a'},{n:'b'},{n:'c'},{n:'d'}...{n:'y'}]; The array may contain between 1 and 50 objects, and the data format is a 1d array coming from a Spine.js model.