Created
December 6, 2009 10:08
-
-
Save pure/250142 to your computer and use it in GitHub Desktop.
Directive - Assign a value
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
<html> | |
<head> | |
<title>PURE Unobtrusive Rendering Engine</title> | |
<script src="../libs/jquery.js"></script> | |
<script src="../libs/pure.js"></script> | |
</head> | |
<body> | |
<!-- HTML template --> | |
<div class="template"> | |
Hello <a></a> | |
</div> | |
<script> | |
var data = {'who':'BeeBole!', site:'http://beebole.com'}, | |
directive = { | |
// look for the tag 'a' and place the value of | |
// the property 'who' in its node value | |
'a':'who', | |
// look for the tag a, and set its attribute 'href' | |
// to the value of the property 'site' | |
'a@href':'site' | |
} | |
// note the use of render instead of autoRender and the 2nd | |
// parameter with directive | |
$('div.template').render(data, directive); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment