JavaScript Backbone. js framework Environment setup and Hellow world example, backbone. jshellow

Source: Internet
Author: User

JavaScript Backbone. js framework Environment setup and Hellow world example, backbone. jshellow

Environment preparation
Before learning about Backbone, you need to prepare something:
First, you need to get the Backbone framework source file: http://documentcloud.github.com/backbone/
Backbone relies on the underlying approach of the Underscore framework, so you also need to download the source file of the Underscore framework: http://documentcloud.github.com/underscore/
In Backbone, DOM and event operations depend on third-party libraries (such as jQuery or Zepto). You only need to select one of them for download:
JQuery: http://jquery.com/
Zepto: http://zeptojs.com/
It seems quite troublesome, but the purpose of Backbone is to use a simple framework to build complex applications, so it is not complicated.
You can create an HTML page and introduce these frameworks, like this:

<script type="text/javascript" src="jquery/jquery-1.8.2.min.js"></script> <script type="text/javascript" src="underscore/underscore-min.js"></script> <script type="text/javascript" src="backbone/backbone-min.js"></script> 

Now, you have prepared the environment required to run Backbone.

Hellow World
Let's take a look at the helloworld function: there is a report button on the page, click the pop-up input box, enter the content, confirm, and finally the content will be added to the page. The page is shown as follows:

Let's look at the code below:

<! DOCTYPE html> 

I think the code is intuitive. This involves three parts of backbone: view, model, and collection. We will mention that model represents a data model, collection is a set of models, while view is used to process pages and simple page logic.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.