Skip to content

Instantly share code, notes, and snippets.

@devdays
Created December 18, 2014 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devdays/280756ead25272230d42 to your computer and use it in GitHub Desktop.
Save devdays/280756ead25272230d42 to your computer and use it in GitHub Desktop.
Single Page App - Loading Template Script Using Require
require(['underscore', 'text!../Templates/productsTmpl.html', 'domReady!'],
function (_, productsTemplate) {
var productsData = [{ name: 'Action Figure', category: 'Toy' },
{ name: 'Bicycle', category: 'Transportation' }];
var output = _.template(productsTemplate, { products: productsData });
document.body.innerHTML = output;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment