Skip to content

Instantly share code, notes, and snippets.

@dspangen
Last active December 20, 2015 22:49
Show Gist options
  • Save dspangen/6207791 to your computer and use it in GitHub Desktop.
Save dspangen/6207791 to your computer and use it in GitHub Desktop.
var View = Marionette.ItemView.extend({
ui: {
link: ".link a"
},
onRender: function() {
// We need to update the view when the text changes
this.listenTo(this.model, "change:linkText", function() {
this.ui.link.text(this.model.get("linkText"));
this.ui.link.attr('title', this.model.get("linkText"));
});
// Or, more commonly
this.listenTo(this.model, "change:linkText", this.render);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment