Skip to content

Instantly share code, notes, and snippets.

@jackey
Created December 21, 2011 09:40
Show Gist options
  • Save jackey/1505400 to your computer and use it in GitHub Desktop.
Save jackey/1505400 to your computer and use it in GitHub Desktop.
events binding missed!
router:
App.bones
```javascript
router = Backbone.Router.extend({
routes: {
'front': 'front'
},
front: function () {
this.send(views.Front);
},
send: function (view) {
var v = new view;
v.render();
$('#page').empty().append(v.el);
}
});
```
App.server.bones
```javascript
routers['front'].prototype.send = function (view) {
var main = new view;
var appv = new views.App({
main: $(main.render().el).html()
});
this.res.send($(appv.render().el).html());
}
```
views:
Front.bones
```javascript
view = Backbone.View.extend({
events: {
'click a': 'click'
},
click : function () {
console.log('this function never be executed on client side');
},
render:function () {
$(this.el).html(templates.App)
}
});
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment