Skip to content

Instantly share code, notes, and snippets.

@morganney
Last active August 29, 2015 13:55
Show Gist options
  • Select an option

  • Save morganney/8760457 to your computer and use it in GitHub Desktop.

Select an option

Save morganney/8760457 to your computer and use it in GitHub Desktop.
Example Usage of Backbone PostView Employing Gister
/*
* Sample usage of the PostView.
* Note, this example assumes that the model is used outside of a collection
* and the post content contains elements with a data-gistId attribute.
* For example:
* <code data-gistId='12345'></code>
*/
require.config({/* The configuration needed for your app to work with RequireJS. */});
require([
'models/post',
'views/post'
], function(Post, PostView) {
var p = new Post(),
pv = new PostView({model: p, dataAttrName: 'gistId'});
// Now just fetch the model to invoke pv.render().
p.fetch();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment