Created
May 18, 2010 20:47
-
-
Save ianb/405517 to your computer and use it in GitHub Desktop.
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
templateDirectives = { | |
'page-main': { | |
... | |
}, | |
'page-view': { | |
... | |
} | |
}; | |
templates = {}; | |
$('#templates > div').each(function (index) { | |
var name = this.className.split(' ')[0]; | |
var directives = templateDirectives[name]; | |
var template = $(this).compile(directives); | |
templates[name] = template; | |
}); | |
function renderPage(name, data) { | |
var template = templates[name]; | |
$('#body').html(template(data)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment