samedi 20 février 2016

Ember: Exchanging the model within an action-handler

How can I change the data of the model on a route as a reaction on a user interaction like pushing the button?

I want to have a productsearch-route where the model holds the items. This set on items can change when the user clicks sets criteria and clicks search. I have a component which sends an action everytime the user fills a form and presses the button "search". The route handles the action in

//rounte.js
action: {
  searchClicked: {
    var newdata = this.get('store').query('item', {...});
    this.set('model', newdata); //<<<< this is not working!!
  }
}

If im doing so, exceptions will approaching. Also im afraid that this can't work even if if there are no exceptions because the template wont update itself I guess.

However: How can I set(/completly exchange) the model from actions in a route?




Aucun commentaire:

Enregistrer un commentaire