Skip to content

Instantly share code, notes, and snippets.

@jneurock
Last active October 11, 2018 13:30
Show Gist options
  • Save jneurock/b1167b777c238f5f1fd6ac7e5c597705 to your computer and use it in GitHub Desktop.
Save jneurock/b1167b777c238f5f1fd6ac7e5c597705 to your computer and use it in GitHub Desktop.
Ember Data Cart Items Example Expanded
import Route from '@ember/routing/route';
import { hash } from 'rsvp';
export default Route.extend({
async model(params) {
let [cart] = await this.store.query('cart');
let cartItems = this.store.query('cart-item', {
filter: { cartId: cart.id },
include: 'address',
page: {
number: params.page,
size: params.pageSize
},
sort: params.sort
});
return hash({ cart, cartItems });
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment