handlebars.js

Bypass/disable uppercase -> global inference in Handlebars templates?

我与影子孤独终老i 提交于 2020-01-05 04:27:04
问题 I have the following handlebars template (fragment): {{#each cbe in abs.XyzBookingEntries}} <tr> {{#if cbe.isLoaded}} <td>{{cbe.XYZdata.ApptDuration}} min:</td> <td> {{cbe.XYZdata.ApptType}} {{#if cbe.XYZdata.ApptTypeDetailCode}} ({{cbe.XYZdata.ApptTypeDetailCode}}) {{/if}} </td> <td {{bindAttr class="cbe.XYZdata.statusClass"}}><strong>{{cbe.XYZdata.ApptStatus}}</strong></td> {{else}} <td> Loading... </td> {{/if}} </tr> {{/each}} From which you can observe two things: I have capitalized

Does Handlebars.registerHelper support async functions?

点点圈 提交于 2020-01-04 17:29:09
问题 Is it possible to create a Handlebars Helper Function that returns async result? Maybe Handlebars supports some kind of two way binding? I want to use JSON data from JSONP request so jQuery.ajax also does not support async: false, but however this would not be exactly the same that I am looking for. 回答1: You can call whatever functions you want in a helper but that won't do you any good. The problem is that Handlebars helpers work with strings and someone else will convert those strings to

Meteor template not updating using click event

旧城冷巷雨未停 提交于 2020-01-04 11:57:05
问题 I'm trying to make a reactive menu using meteor session (to persist the view the user was).. but it is not working, the Session.get('currentView') get changed (teste in chrome console), but the page don't render again. .html <div class="col-1-1 menu" style="height: 42px;"> <ul> <li><a class="dashButton" href="#"># Dashboard</a></li> <li><a class="myJobsButton"href="#">Jobs</a></li> <li><a class="helpPageButton"href="#">Help</a></li> </ul> <br style="clear:left"/> </div> {{#if currentViewIs

Sort object keys with Handlebars

佐手、 提交于 2020-01-04 09:14:05
问题 I know that Javascript object keys are not 'ordered' so by definition cannot be sorted – however I would like to output them in alphabetical order using Handlebars for display purposes. The part of the object I'm interested in looks like this: { "A publisher" : { journals : { "A journal" : {}, "B journal" : {}, "C journal" : {} } } "B publisher" : { journals : { "D journal" : {}, "E journal" : {}, "F journal" : {} } } } I'd like to be able to template the object using Handlebars ordered

Grails internationalization with Ember.js and Handlebars.js

匆匆过客 提交于 2020-01-04 05:57:44
问题 I'm developing a web application and I'd need some advice on how to solve the following 'problem' of internationalization. I use Grails 2.2.0 along with Ember.js and Handlebars.js whereas the frontend (which is realised through JavaScript with the before mentioned frameworks) is residing in it's on project with the Sass files for styling Grunt.js for compiling the whole thing. Within this 'frontend project' I create the handlebars templates which I want to deliver via Grails on demand, with

handlebar precompile version error in Ember rc5

二次信任 提交于 2020-01-04 05:25:12
问题 I'm upgrading to Ember rc5 from rc3, but I'm getting the following error: Uncaught Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version (>= 1.0.0-rc.4) or downgrade your runtime to an older version (== 1.0.0-rc.3) Here are the relevant lines in my gemfile, taken straight from the ember-rails README (except pulling the gem from git... it gives the same error whether I include that or not) gem 'ember-rails', git

Two ways to define helpers in Meteor

馋奶兔 提交于 2020-01-04 05:15:36
问题 EDIT: This is no longer relevant in Meteor 1.0. The first syntax has been deprecated, and only the second is supported. It seems that there are two ways to define what are apparently called helpers in Meteor: Template.foo.helper1 = function() { ... } Other way: Template.foo.helpers({ helper2: function() { ... } }); Is there any semantic or usage difference between the two? The only restriction I can see is that the first usage can't use reserved keywords. I'm wondering if the distinction

handlebars: how to access an array?

只愿长相守 提交于 2020-01-03 15:33:25
问题 I have the following simplified document: { channel:'Channelname', users: [ {userId:1}, {userId:2}, {userId:3} ] } How can i access the userId's in a {{#each}} loop like so: {{#each channels}} {{channel}} {{#each channels.users}} {{userId}} //or {{channels.users.userId}} ? {{/each}} {{/each}} The first {{#each}} loop prints my channelname as expected, but the second {{#each}} loop doesn't print anything. Regards, Cid 回答1: Use {{#each channels}} {{channel}} {{#each users}} {{userId}} {{/each}}

In Ember.js templates, how does one print out model's property that will be use by HTML like the src for image or href for link

余生颓废 提交于 2020-01-03 07:38:07
问题 Using: ember: v1.0.0-pre.4 ember-data: revision 11 handlebars: 1.0.rc2 So I have a template that I've hooked up to a controller that's receiving info from an REST API. In just print out text, this is fine but these handlebar expression... <img src="{{ imageUrl }}"/> ...when inserted into the dom look like: <img src="<script id='metamorph-28-start' type='text/x-placeholder'></script>http://asdf.com/image.jpg<script id='metamorph-28-end' type='text/x-placeholder'></script>"> I'm obviously very

Mixing handlebars.js and CSS - Random background image?

ぃ、小莉子 提交于 2020-01-03 03:38:06
问题 I would like to set a randomly generated background image. I am using Meteor and am calling Flickr API to provide a random image URL which I would like to set as my background image. From what I've read, it seems that CSS is now the recommended way to set a background image. Is there a way to inject the dynamically generated url into the CSS? I can't seem to find examples showing mixing of Handlebars.js and CSS - is this possible? Or should I be avoiding CSS and setting the background image