S
S
Stepan2014-08-10 17:40:23
JavaScript
Stepan, 2014-08-10 17:40:23

How to access nested parameters in models in Backbone?

defaults: {
        'city': "Москва",
        'user': {
            'name': "Ваше Имя",
            'password': ""
        },

How to get to name and change it via set?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MCBumf, 2014-08-15
@xoma2

There are quite a few extensions that solve this problem. Here is one of them from a domestic manufacturer: backbone.ribs
And here the problem itself and the solution are well described: habrahabr.ru/company/mailru/blog/228135

N
namit, 2014-08-10
@namit

Alas, no way. Only the user of all to receive and change. Well, or through obj.attributes.user.name, where obj is an instance of your model. But it's kind of bad practice to access attributes directly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question