icanhaz.js

icanhaz/mustache loop (iterate through elements) js error

时光怂恿深爱的人放手 提交于 2019-12-29 08:24:07
问题 I'm trying to get icanhaz/mustache loop working, as defined in this answer and I'm getting following error in browser console: Uncaught Error: Syntax error, unrecognized expression: <option value="1">First</option> <option value="2">Second</option> Don't know why. I've just managed to spot that this is the line that causes the problem: ich.myTemplate(listOfStuff); This is my entire code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/tr/html4/transitional.dtd"> <html>

Backbone Marionette and ICanHaz (Mustache) templates configuration

天涯浪子 提交于 2019-12-24 16:38:58
问题 I'm migrating a Backbone basic app to Marionette and I would like to use ICanHaz.js as a template system (based on Mustache). I'm using AMD and Require.js and the only way to make ICanHaz.js working with it and Backbone was to use jvashishtha's version. I first implemented the app in pure Backbone style. In particular I used to load each template as raw strings with the Require.js' text plugin and then add the template to the ich object. This create a method in ich object that has the same

icanhaz not finding template

[亡魂溺海] 提交于 2019-12-23 03:53:06
问题 To make this example as simple as possible, let's say I have the following code in home.html: <html> <head> <!-- ALL DEPENDENCIES FOR ICANHAZ ARE INCLUDED ABOVE --> <script type="text/html" id="foo" src="js_template.js"></script> <script>ich.foo({})</script> </head> <body></body> </html> And in javascript_template.js, I have the following: Hello world! As it turns out, icanhaz is not detecting foo, so ich.foo({}) is throwing an error. What exactly is going on here? 回答1: ICanHaz.js does not

ICanHaz.js - Possible to put a while loop in template?

左心房为你撑大大i 提交于 2019-12-22 08:46:31
问题 Let's say I have a element, and inside it want to put an indefinite number of items (based on the user's choices). Is there a way to create an ICanHaz template that allows for some sort of while loop. For instance: <ul> for(i = 0; i < numOfLi; i++) <li> {{ stuff }} </li> </ul> 回答1: icanhaz (moustache) does include a way to loop. In javascript: var listOfStuff = {stuff: [ {key: "1", desc: "First"}, {key: "2", desc: "Second"} ]}; $("#mySelectBox").append(ich.myTemplate(listOfStuff)); In your

ICanHaz.js - Possible to put a while loop in template?

可紊 提交于 2019-12-05 17:46:40
Let's say I have a element, and inside it want to put an indefinite number of items (based on the user's choices). Is there a way to create an ICanHaz template that allows for some sort of while loop. For instance: <ul> for(i = 0; i < numOfLi; i++) <li> {{ stuff }} </li> </ul> bostonou icanhaz (moustache) does include a way to loop. In javascript: var listOfStuff = {stuff: [ {key: "1", desc: "First"}, {key: "2", desc: "Second"} ]}; $("#mySelectBox").append(ich.myTemplate(listOfStuff)); In your view: <script id="myTemplate" type="text/html"> {{#stuff}} <option value="{{key}}">{{desc}}</option>

icanhaz/mustache loop (iterate through elements) js error

你说的曾经没有我的故事 提交于 2019-11-29 12:59:48
I'm trying to get icanhaz/mustache loop working, as defined in this answer and I'm getting following error in browser console: Uncaught Error: Syntax error, unrecognized expression: <option value="1">First</option> <option value="2">Second</option> Don't know why. I've just managed to spot that this is the line that causes the problem: ich.myTemplate(listOfStuff); This is my entire code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/tr/html4/transitional.dtd"> <html> <head> <title>icanhaz.js demo</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"

Integrating iCanHaz and Marionette

前提是你 提交于 2019-11-29 12:58:24
I'm a big fan of ICanHaz, and I'm trying to directly intregrate it into a new Marionette application I'm building. However, going off this post , I have written this that reaches into the render method and changes it in Marionette: // Set up Initalizer APP.addInitializer(function() { //Reach into Marionette and switch out templating system to ICH Backbone.Marionette.Renderer.render = function(template, data){ return ich[template](data); } //Create Router new APP.Routers.GlobalRouter(); //Start Backbone History Backbone.history.start(); }); If I walk through this function, all the data seems to

Integrating iCanHaz and Marionette

和自甴很熟 提交于 2019-11-28 06:43:58
问题 I'm a big fan of ICanHaz, and I'm trying to directly intregrate it into a new Marionette application I'm building. However, going off this post, I have written this that reaches into the render method and changes it in Marionette: // Set up Initalizer APP.addInitializer(function() { //Reach into Marionette and switch out templating system to ICH Backbone.Marionette.Renderer.render = function(template, data){ return ich[template](data); } //Create Router new APP.Routers.GlobalRouter(); //Start