Skip to content

Instantly share code, notes, and snippets.

/1.js

Created August 1, 2014 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/39556267709b3dc510ad to your computer and use it in GitHub Desktop.
Save anonymous/39556267709b3dc510ad to your computer and use it in GitHub Desktop.
Backbone Directives example
var model = new Backbone.Model({counter: 1});
var MyView = Backbone.View.extend({
render: function() {
this.$compile();
return this;
}
});
var view = new MyView({
el: $('.some-element'),
model: model
});
<div class="some-view">
<span bb-bind="counter"></span>
</div>
<span bb-bind="counter * 2"></span>
<span bb-bind="counter % 2 == 0 ? 'even' : 'odd'"></span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment