I have a route like this:
ConsultasRoute = Em.Route.extend({
model: function() {
return Em.Object.create({
tipoClave: undefined,
tipoConsulta: {id: 2, nombre: 'yow man'}
});
}
});
I have a controller like this:
ConsultasController = Ember.ObjectController.extend({
tipoConsultas: [{id: 1, nombre: 'dudeee'}, {id: 2, nombre: 'yow man'}]
});
And a template like this:
{{view 'select' content=tipoConsultas selection=model.tipoConsulta optionValue="content.id" optionLabelPath="content.nombre" prompt="Selecciona tipo consulta"}}
The idea is: by default the selected tipo consulta is "yow man".
But this does not work; "yow man" is not selected by default.
I think object-equality thing is in the play here. How to tell ember to do object-equality check using specific property of an object (e.g.: the "id") ?
I read about this Comparable Mixin: http://ift.tt/1ph7Zms maybe this can help (?). But I can't find an example of its correct use anywhere.
Can someone show me how to solve this?
Thanks in advance, Raka
Aucun commentaire:
Enregistrer un commentaire