Questions tagged [icanhaz.js]

ICanHaz is a JavaScript templating library

ICanHaz combines Mustache.js with jQuery and Zepto for easy client-side templating. ICanHaz could be used any time client-side HTML is being built from JavaScript objects. More information and usage is available at http://icanhazjs.com/.

49 questions
27
votes
2 answers

how to access nested objects with mustache js templating engine

I've this json return { "timeline": [{ "id": "2", "self": { "uid": "2", "username": "ptamzz" }, "file": { "fid": "43", "file_name": "First Name" }, …
ptamzz
  • 9,235
  • 31
  • 91
  • 147
6
votes
2 answers

ICANHAZ.js render dom element instead of text

Param: '
' + somecontent + '
' + somecontent2 Template:
{{ param }}
And in browser I have: <div class="someclass"> somecontent </div>somecontent2 How to isolate .someclass, that it render as a…
xquezme
  • 61
  • 1
5
votes
1 answer

iCanHaz.js - separating templates?

Using ICanHaz.js is really nice - it's dead simple to create, load and render templates from javascript objects. However, in a somewhat big javascript application, the .html-file that initiates my application and contains all the ICanHaz-templates…
Industrial
  • 41,400
  • 69
  • 194
  • 289
5
votes
1 answer

Pulling icanhaz templates from a remote server

The icanhaz documentation uses this as an example as how to pull ich templates from a remote server. $.getJSON('/myserver/templates.json', function (templates) { $.each(templates, function (template) { ich.addTemplate(template.name,…
user961794
  • 111
  • 11
4
votes
1 answer

How can i load ICanHaz.js templates with node.js?

I read on ICanHaz.js documentation that i should load templates from a remote like this $.getJSON('/myserver/templates.json', function (templates) { $.each(templates, function (template) { ich.addTemplate(template.name,…
Ludvig
  • 637
  • 6
  • 18
4
votes
1 answer

Loading mustache template in jQuery returns Document object instead of raw string

I am using icanhaz.js and mustache for loading templates, and I am loading mustache templates on demand using the following method: loadTemplate: function(name, callback) { if (!ich.templates[name+"_template"]) { …
xncroft
  • 143
  • 1
  • 1
  • 7
4
votes
3 answers

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

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:
    for(i = 0; i <…
Danny Anges
  • 237
  • 5
  • 10
4
votes
1 answer

how to use ICanHaz for moustache javascript template engine?

I've a JSON string: { "items": [ {"name": "red" }, {"name": "blue" } ], "test" : { "items" :[ { "name" : "Hello" }, { "name" : "World" } ] } } How do I print out…
ptamzz
  • 9,235
  • 31
  • 91
  • 147
3
votes
3 answers

External Javascript File with Script tags

I am using a javascript templating framework called ICanHazjs.com. My questions is can I include tags inside of a external javascript file, and if so is there any downsides / compatibility issues with this? And if I can't what can I attach that…
Adam
  • 725
  • 9
  • 17
3
votes
2 answers

icanhaz.js & Mustache.js: Rendering more complex items

I've been using icanhaz.js for some JS template rendering and it's great! However, I can't seem to grasp the idea behind rendering some complex objects, and then iterating over them. Basically, in the header of a template I want to render a few…
Bartek
  • 15,269
  • 2
  • 58
  • 65
3
votes
2 answers

How do I make Caja preserve template text inside a script tag?

I was trying to see if I could use ICanHaz or Handlebars for building the sidebar of my Google Docs Add-on. However, it turns out Caja is stripping the actual HTML from my script tag. Is there any way to prevent this from happening? Let's just say…
Wilfred Springer
  • 10,869
  • 4
  • 55
  • 69
3
votes
1 answer

Access Mustache object inside ICanHaz object

I am using icanhaz inside my project. As per documentation it says that it includes the Mustache.js as well. Now I want to access the embedded Mustache object's to_html() method as follows. var message = Mustache.to_html(template, json, true); I am…
ahsan_cse2004
  • 182
  • 4
  • 16
2
votes
1 answer

what are the main differences between jquery's official templating plugin and ICanHaz.js?

So far I've had nothing but good things to say about the jQuery plugin. It's been easy to use and has done what I need, and while that should be all I need to formulate an answer I'd like to hear from naysayers and users of other comparable…
Lee
  • 21
  • 1
2
votes
1 answer

rendering HTML string from JSON with ICanHaz

I am working on a simple blog application using MVC 4 and the new WebAPI. I am also using ICanHaz.js for the rendering of the results returned from the webAPI methods I have created. I have been able to get the rendering to work, but the actual text…
ncbl
  • 1,295
  • 2
  • 12
  • 19
1
vote
1 answer

iCanHaz.js + Moustache doesn't render first row in data object

I have a JSON data object and a text/html javascript template written using the Moustache syntax. I'm using iCanHaz.js as a template parser. My problem is that the first row in the data object doesn't get displayed. Here is my JS code: var data =…
Oskar Smith
  • 999
  • 2
  • 8
  • 9
1
2 3 4