-
-
Save anonymous/39556267709b3dc510ad to your computer and use it in GitHub Desktop.
Backbone Directives example
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
var model = new Backbone.Model({counter: 1}); |
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
var MyView = Backbone.View.extend({ | |
render: function() { | |
this.$compile(); | |
return this; | |
} | |
}); | |
var view = new MyView({ | |
el: $('.some-element'), | |
model: model | |
}); |
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
<div class="some-view"> | |
<span bb-bind="counter"></span> | |
</div> |
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
<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