I’ve been learning about Backbone.js and I’m attempting to try and create a simple project that just deals with one component of Backbone – the View – and then transition into making models and collections as I need them. It seems like tackling the framework in pieces would make it easier to get my head around it.
I figured that a good starting point would be a login screen that transitions to a home page. Here is a link to a fiddle that I made and I was wondering if those of you who are more experienced in Backbone could take a look and let me know if I’m on the right track.
http://jsfiddle.net/phillipkregg/tVmTM/
I plan on adding more components to this and growing it out as I learn more about the framework, so it would be great to get some feedback on best-practices to make sure I’m not shooting myself in the foot right off the bat.
Yea, you are on the right track.
I agree it’s a good idea to start simple and then progress to more complicated scenarios as you’re learning Backbone.
One small tidbit I have is that Backbone will set the scope context for the event handlers that are declared in the events property. What that means is that you do not have to include the login_press as an argument in _.bindAll because Backbone does that for you.
As you progress, be sure to learn more about its router and how you can use it in this situation.