jeudi 2 avril 2015

How replace Ember.ObjectController with Ember.Controller

An application I'm currently working on uses an Ember.ArrayController to load a couple of place models. To obtain different behavior for different model types I used the lookupItemController like this:


PlacesController



lookupItemController: function(object) {
if(object.get('isNew')) {
return "places.new";
} else {
return "places.index";
}
}


PlacesNewController



needs: ['places']

isDraggable: Ember.computed.alias('isCloseEnough')

isCloseEnough: false
isZoomMax: false
isMarkerAdded: false

...


PlacesIndexController



needs: 'places',
isDraggable: false,
modelBinding: 'places.model'

...


But now the Ember.ObjectController is deprecated. My question is therefor: how can I get the same behavior using the Ember.Controller?





Aucun commentaire:

Enregistrer un commentaire