niedziela, 26 maja 2013

Backbone.js in action

The last time JavaScript libraries, separating application code (as the MVC server's frameworks), are gaining on popularity. Below I will present a simple example implemented in backbone.js, which will show the possibility of the library and you will understand why it is worth to use it. Let's start by creating a directory empapp and put in it the index.html: This page contains an element body, in which are included three libraries: jquery, underescore, backbone and main.js, which contains a code of sample application written in backbone. So let's create a directory empapp, file main.js and fill out its contents: The effect may not be impressive :)

New Employee
First name:
Last name:
  • John Smith   
  • Jim Bean   

However, we obtained the objective because the model is separated from the view, and everything is in JavaScript, and yet what we wanted :)

Source on GitHub