骨干深度模型设置属性

时间:2013-09-10 06:06:20

标签: javascript jquery backbone.js

我正在尝试将[骨干深度模型](https://github.com/powmedia/backbone-deep-model)用于具有嵌套属性的Person模型。 github中的示例代码显示了设置名称

等嵌套属性
 model.set({
    'user.name.first': 'Lana',
    'user.name.last':  'Kang'
}); 

但如何设置模型属性otherSpies.name [0]:'Lana'?

我个人模型的JSON格式如下所示。

  {
    "birthdate": "2005-10-26T00:00:00.000+0530",
    "gender": "M",
    "attributes": [
        {
            "value": "saagar.gugwad@gmail.com",
            "attributeType": "8d6d7f78-9b9e-409a-96dc-ea8300e54175"
        },
        {
            "value": "single",
            "attributeType": "6b550dd7-ce73-4f14-af2d-35d1a37e7377"
        },
        {
            "value": "7829730769",
            "attributeType": "d1266776-7431-4fa4-9724-215c21418efb"
        },
        {
            "value": "0",
            "attributeType": "892089d1-f187-404b-89c3-96606194a05c"
        },
        {
            "value": "AAAAAACAGwEtAAHMpTgHAAAAAElFTkSuQmCC\n",
            "attributeType": "d5ac7b1d-a563-4661-9d9d-0ad6b8e346e8"
        }
    ],
    "addresses": [
        {
           "address1":"bla",
           "address2":"bla2",
           "street"  :"walstreet",
           "pincode" :"222FB"
        }
    ],
    "names": [
        {
            "familyName": "Dbh",
            "givenName": "Saagar"
        }
    ],
    "age": 8
}

我想使用personModel设置属性。我怎么能做到这一点?

0 个答案:

没有答案