开发者

Is it bad behaviour to put views inside models? (Backbone.js)

Hi i have a model that has models inside and inside... I need to give view to all of them and reach them in a hirearc开发者_运维问答hy.

A Model
|
+---B Model
|   |
|   +----C Model
|   |
|   +----C Model
|
+---D Model

Think that all that models has views and for example when B models render function called i need to call both C models render functions.

So i decided that to create all related views inside models via overriding initialize methods.

So my question is that kind of behaviour is bad for mvc architecture? or it's natural?


I don't think models should know about views. It ought to be the other way 'round.

The view ought to be able to walk the model hierarchy, not the other way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜