Skip to content

Instantly share code, notes, and snippets.

@h5y1m141
Created May 8, 2012 23:51
Show Gist options
  • Save h5y1m141/2640505 to your computer and use it in GitHub Desktop.
Save h5y1m141/2640505 to your computer and use it in GitHub Desktop.
Titanium Mobile w/ mustache.js sample
var Mustache = require("lib/mustache");
var data ={
"list":[
{"value": "a1",top:0},
{"value": "a2",top:50},
{"value": "a3",top:100}
]
};
var win = Ti.UI.createWindow({
backgroundColor:'#FFF'
});
eval(Mustache.render(
'{{#list}}'
+ 'var {{ value }} = Ti.UI.createLabel({left:5,top:{{top}},text:"{{ value }}" });'
+ 'win.add({{value}});'
+ '{{/list}}'
,data));
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment