简体   繁体   中英

Update list of records in ember-data model

I am loading list of product in ember model.

products: this.store.findAll('products');

Now I have to add 1 property to each product and then it should save all models with only one network request.

I am updating property as below

product.set('reviewed', true);

I am looping through model.products and setting the property what is the best way to save all list of products at once.

There is no standard way of doing this, that I know of currently.

Here is the github issue tracking this. A similar SO question .

You will most likely want to find an addon that does something like this, or you could investigate doing it yourself by extending the adapter you currently use or creating a simple service with a queue you can push to and a save method with a custom request.

Here is a comprehensive gist where the adapter is extended with some functionality with this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM