ember.js - What type of controller should I use to represent a complex object which is not a (persisting) model? -
ember.js - What type of controller should I use to represent a complex object which is not a (persisting) model? -
i'm writing calendar application, need display events month.
while i'll need create objects represent calendar months, take these these calendermonth
objects should not 'models
' (in ember
terminology), since calendarmonth
objects won't persist server (whereas event
objects will). instead, calendarmonths
'objects'
, build calendarmonth 'class'
, extending ember.object
so then, sort of controller utilize proxy (frequently changing) calendarmonth
object? (vanilla
) controller? objectcontroller
? arraycontroller
?
objectcontroller
seems way go, since intention the controller deed proxy single object. think i'm thrown fact in corresponding route object, i'd assigning calendarmonth
object controller's model. when, it's not model, it's object.
put way, question is:
is bad practice assign ember object
not model objectcontroller's
'model'
property?
it not bad practice utilize normal js object controller's model/content. matters how view going render model. if you're going display single event @ time, or single month events in month, objectcontroller
best bet.
an arraycontroller
used when want loop round model/content in controller , display each item in view. don't think should worry much controller should use, become pretty obvious 1 want decide how create view.
when ember talks using model
controller, can utilize own ember object if wish , reference in controller, doesn't matter if natural js object or ember object. controller sees both fine.
ember.js
Comments
Post a Comment