Created
December 18, 2014 20:10
-
-
Save devdays/280756ead25272230d42 to your computer and use it in GitHub Desktop.
Single Page App - Loading Template Script Using Require
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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