Last active
August 29, 2015 13:55
-
-
Save morganney/8760457 to your computer and use it in GitHub Desktop.
Example Usage of Backbone PostView Employing Gister
This file contains hidden or 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
| /* | |
| * 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