Backbonejs creating a data model and setting default properties & Initialization Methods

Source: Internet
Author: User

1<!doctype html>2"en">34<meta charset="UTF-8">5<title>Document</title>6<script src='./js/underscore.js'></script>7<script src='./js/backbone.js'></script>8 9Ten  One<body> A      -  -  the<script type="Text/javascript"> -  -             //Create a data model -  +             varStudent =Backbone.Model.extend ({ -  +                 //initialization function A initialize:function () { at  -num++; - console.log (num); -                 },     -  -                 //set default values for the data model in defaults:{ -Name"", toPhone"" +                 } -  the             }); *  $             varnum =0;Panax Notoginseng             varS1 =Newstudent (); -             //methods for assigning values to model objects theS1.Set({name:"Huangze Shower", Phone:"13751877760"}); +  A             varS2 =Newstudent ();  the  +             //Gets the property value method of the Model object get (Attrname) or Escape (attrname) -  $Console.log (S1.Get("Phone")); $</script> -</body> -

Backbonejs creating a data model and setting default properties & Initialization Methods

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.