jeudi 25 février 2016

Ember - How to get route model inside route action

Is it possible to access route model inside route action?

I am passing multiple objects inside a route model to template,

 model: function() {
    return {
        employeeList : this.store.findAll("employee"),
        employee : Ember.Object.create()
    }
}

From the route action I am want to modify the route model.employee. I tried the following, but I am not getting the object.

actions:{
    editAction : function(id) {
        var emp = this.get("model");
        console.log(emp.employee);

    }
}

Can anyone give a solution to get and modify model object(employee)?




Aucun commentaire:

Enregistrer un commentaire