Skip to content

Instantly share code, notes, and snippets.

@benolee
Last active December 19, 2015 03:19
Show Gist options
  • Save benolee/5889454 to your computer and use it in GitHub Desktop.
Save benolee/5889454 to your computer and use it in GitHub Desktop.
Ember Handlebars helpers
<!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