-
-
Save muhamed-didovic/afbbc081816848c3c68d to your computer and use it in GitHub Desktop.
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
| // Which do you prefer more? | |
| // trigger event and get out | |
| var vent = _.extend({}, Backbone.Events); | |
| App.Router = Backbone.Router.extend({ | |
| routes: { | |
| 'show/:id': 'show' | |
| }, | |
| show: function(id) { | |
| vent.trigger('thing:show', id); | |
| } | |
| }); | |
| // Or, perform logic | |
| App.Router = Backbone.Router.extend({ | |
| routes: { | |
| 'show/:id': 'show' | |
| }, | |
| show: function(id) { | |
| var thing = new Thing({ name: 'Joe'}); | |
| var thingView = new ThingView({ model: thing }); | |
| $(document.body).append(thingView.render().el); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment