Last active
December 19, 2015 03:19
-
-
Save benolee/5889454 to your computer and use it in GitHub Desktop.
Ember Handlebars helpers
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script> | |
<script src="http://builds.emberjs.com.s3.amazonaws.com/handlebars-1.0.0-rc.4.js"></script> | |
<script src="http://builds.emberjs.com.s3.amazonaws.com/ember-1.0.0-rc.6.js"></script> | |
<meta charset=utf-8 /> | |
<title></title> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
{{hello-message name='world!'}} | |
</script> | |
<script> | |
App = Ember.Application.create(); | |
Ember.Handlebars.helper('hello-message', Ember.View.extend({ | |
init: function() { | |
this._super(); | |
this.set('context', this); | |
}, | |
template: Ember.Handlebars.compile('{{greeting}}, {{name}}'), | |
greeting: 'Hello' | |
})); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment