S
S
Serhio Seal2015-06-09 23:58:44
backbone.js
Serhio Seal, 2015-06-09 23:58:44

Where is the right place to write code in a backbone application?

Hello.
Suppose in the project structure, for example, this:
-Models
----users.js
----groups.js
-collections
----users.js
----groups.js
-views
----users.js
-- --groups.js
Is there a code that, when entering data into an input, creates instances of the users model, where is it more correct to write this code? In the model or in the view? Or maybe you can write in a separate file all the interaction with the main objects of the application?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2015-06-10
@serhioone

Your models do not exist outside of collections. This means that the logic for their creation (and deletion) lies in the collections.
Of course, the logic for extracting data from the form and passing it to the collection remains in the view.

S
Sergey, 2015-06-10
Protko @Fesor

There is also such a thing as a controller. View calls the controller because its state has changed, the controller decides what to do and what it tells the view to update.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question