jeudi 28 janvier 2016

How to get reference to current model in Ember?

I have very simple scenario. I retrieve particular instance of a model

model: function(params) {
  return this.store.findRecord('project', params.id);
},

and I provide form for editing it:

<h2>Edit project {{model.title}}</h2>
<label>Project title</label> 
<br/>
{{input value=model.title size="50"}}

<label>Project description</label>
{{input value=model.description size="50"}}

<label>Project explanation</label>
{{textarea value=model.full_description cols="50" rows="6"}}

{{#bs-button action="saveProject"}}Save{{/bs-button}}

Then in saveProject action handler I need to have a reference to model that was edited. How can I retrieve it?

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire