lundi 3 juillet 2017

How to use nested call to DataStore in emberJS?

I am trying to have a call the datastore from within THEN() function again to retrieve data from second DS based on founding of FIRST datastore, but "this" is not available in THEN() function. How to do something similar to following example. The second call to this.store.findRecord does not work?

    actions:{

    onBookStoreSelect(bookstore){

            console.log(bookstore.id);
            this.store.findRecord('boston_city_bookstores', bookstore.id).then(function(response){
                console.log(response);
                console.log(response.get('bookstore_address'));
                console.log(response.get('bookstore_owner'));
                console.log(response.get('bookstore_key_ID'));

                this.store.findRecord('books', response.get('bookstore_key_ID')).then(function(bookList){

                    //do something
            });




Aucun commentaire:

Enregistrer un commentaire