Created
October 11, 2018 13:20
-
-
Save jneurock/58fbd1193fe58fe153b83889002e23bf to your computer and use it in GitHub Desktop.
Ember Data Update Cart Items Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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