architecture - Writing first angular app. How should I architect this? -


i'm writing first angular app after messing around basic todo type apps , curious @ proper way architect controllers high level.

the app allow users dynamically add/remove homes plot , each home can have rooms in , each room within home can have products in it. homes, rooms , products can added/removed on fly , rooms 1 home can moved other homes.

my first pass @ has me thinking i'll need controller homes (collection of homes), controller each individual home. same go rooms , products; controller rooms , controller each room.

is best way this? i'm coming @ backbone perspective want follow guidelines angular prescribe don't see online doing this.

any appreciated.

i suggest first think models, views, lastly, controllers.

your models should in services, not controllers. (this way, if multiple views need access same model data, controllers associated views can inject service(s) access shared data/model.)

break page(s) separate views. attach controller each view, , have controller model data needs injected service(s) view can job. make controllers thin possible.

(much of above another answer wrote.)


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -