This must be a simple concept, but it seems to be assumed rather than covered... I have a simple model, journal, and component, journal-list:
<select class="form-control" id="journal" onchange= >
<option value="" disabled="disabled" selected="selected">Periodicals:</option>
<option value=""> </option>
</select>
and action:
import Ember from 'ember';
export default Ember.Component.extend({
editstate: Ember.inject.service('edit-state'),
actions: {
showJournal(journal) {
this.get('editstate').selectedJournal = journal;
alert('got ' + journal.name);
this.sendAction('displayJournal', journal);
}
}
});
That selected value is not, as far as I can tell, useful, and the journal instance in the action isn't either. Ember knows it's type Journal (e.g. <em-journalapp@model:journal::ember385:3>
), but I can't access the members via, e.g., journal.name, journal.get('name') or anything else I've thought of.
I can pass in journal.id instead, and see it. But if I look up the model from the store, the variable again isn't useful.
Is there some magic to casting or storing model data in variables and getting it back out?
Aucun commentaire:
Enregistrer un commentaire