Created
December 21, 2011 09:40
-
-
Save jackey/1505400 to your computer and use it in GitHub Desktop.
events binding missed!
This file contains 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
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