Book Image

CoffeeScript Application Development Cookbook

By : Mike Hatfield
Book Image

CoffeeScript Application Development Cookbook

By: Mike Hatfield

Overview of this book

Table of Contents (18 chapters)
CoffeeScript Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with Backbone


Backbone was created by CoffeeScript creator Jeremy Ashkenas in 2010. The project itself was extracted from Jeremy's work for DocumentCloud as a client-side application framework. It was originally a lightweight client-side Model-View-Control (MVC) framework. It has evolved from it's original 0.1.0 release to remain lightweight, but is no longer an MVC framework strictly speaking. It is instead an MV-Star framework having replaced the notion of a controller with a router instead.

Tip

For more information on Backbone, you can visit the project home page at http://backbonejs.org/.

In this section, we will demonstrate how CoffeeScript can be used to create the various building blocks of an Angular application including the following:

  • Creating models

  • Creating collections

  • Creating views

  • Handling UI events

  • Creating routers

Creating models

In Backbone, the models represent the heart of our application. Models contain our application's interactive data as well as much of the logic surrounding...