samedi 21 novembre 2015

How to Live Update Ember Model with Search Results from API

Quick backgorund: I am creating a recipe app with Ember frontend and a Rails API backend. I am implementing a search feature to find recipes based on ingredients. I have already configured my Rails API endpoint which sends back the correct records. My problem now is that I am having a very difficult time live updating my results, ie. the model data is not updating the template. This seems like a trivial problem, but for whatever reason I haven't been able to figure it out.

Here is what my project looks like:

model(params) {
    this.store.query('recipe', {query: params}).then( response => {
        console.log("RESPONSE", response);
    })
}

recipes index.hbs (this does not currently update):

{{recipe-card-container recipes=model}}

How can I solve this?




Aucun commentaire:

Enregistrer un commentaire