When transitioning to a dynamic route with an empty array as the model, it seems like Ember relates to it as undefined
.
Thus, if this is the template:
{{#linkTo dynamic arrayProxy}}link{{/linkTo}}
and this is the route definition:
DynamicRoute = Ember.Route.create(function() {
model: function(params) {
return this.modelFor("parent").find(params.name);
},
serialize: function(model) {
return { name: model.get("name") };
}
});
when arrayProxy
is either []
or Ember.ArrayProxy.create(content: [])
,
after clicking on the link:
the model hook will not get called, of course.
The serialize hook will get undefined
as the model
, no matter that ArrayProxy is a valid Ember object with its own properties.
Does anyone know how to force ember handle empty arrays differently from undefined
?
ParentRoute
? And where is defined thearrayProxy
property of the template? What is your ember version? – Marcio Junior