Backbone Practical Course (i)

Source: Internet
Author: User
Tags end

Backbone is a front-end JS code MVC framework, but it is not strictly the model, View, Controller (which I will answer in the example). It cannot replace Jquery and cannot replace the existing template library. Instead, it combines with these to build complex Web front-end interactive applications.

Backbone:

    1. force depends on underscore.js, so you must introduce underscore.js before introducing Backbone.js. Underscore.js is a utility library;
    2. does not enforce dependency on Jquery/zepto
    3. automatically updates the application's HTML based on changes to the model to help code maintenance;
    4. Promote client template use and avoid Embed HTML code in JavaScript.

In the next tutorial I will use backbone to implement a simple address book application, the specific page effect I have done:
Backbone Address Book Tutorial page

Address Book Function Analysis:

    1. Address Book page to add, modify, delete contacts (bulk delete), search for contacts
    2. Contact Change Click Save Unified Submit to Server
    3. Real-time display of contact number in the top right

Page MVC Partitioning:

  1. The views, models, and collections that are used by the
  2. Page are unified under the namespace contact, which is:

     var contacts = {Models: {}, Collections: {}, Views: {}}; 
  3. Page two view (Mainview,memberview), a collection to hold the contact set, a model to store the contact models, namely:

     Contact.Models.Member  Contact.Collections.Member  Contact.Views.Member  
  4. Tutorial start data directly with the browser Localstorage to store contacts, because the lower version of the browser does not support Localstorage, so here I use backbone.localStorage.js. Later will use Node.js for back-end support, so there will be node.js tutorials, but also use sea.js to dynamically load the JS library.

This is the end of today's tutorial, please wait!



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.