andyet/ICanHaz.js — Issue #33: template retrieval without hardcoding template name
Author: arjunsharma
Created: 2011-12-06 20:27:50+00:00
State: open

When using AJAX to load my templates, I'm using a format similar to the documentation... my server sends back a JSON object with a "name" parameter and a "template" parameter, and I use ich.addTemplate(name, template).

However, from what I can tell, the only way to a retrieve a template is to use ich.#templateName#(data)... so how can I retrieve a template if the name is stored in a variable and isn't hardcoded? The only solution I've come up with so far is using eval(), but that's not an approach I would like to take.