Skip to content

Instantly share code, notes, and snippets.

@jneurock
Created October 11, 2018 13:20
Show Gist options
  • Save jneurock/58fbd1193fe58fe153b83889002e23bf to your computer and use it in GitHub Desktop.
Save jneurock/58fbd1193fe58fe153b83889002e23bf to your computer and use it in GitHub Desktop.
Ember Data Update Cart Items Example
import Controller from '@ember/controller';
import { all } from 'rsvp';
export default Controller.extend({
actions: {
updateCartItemsAddress(address) {
let cartItems = this.get('model.cartItems');
return all(cartItems.map((cartItem) => {
cartItem.set('address', address);
return cartItem.save();
}).catch(() => {
// This could get weird...
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment