Ember data store handling array of objects

Viewed 17

I'm new to ember and exploring its capabilities by building a small module. I came across a scenario where I need to update the ember model content synchronously. The ember-data model contains an array of objects as contents.

I was hoping to perform a few tasks as follows

  • Perform an array content reorder - for the sake of simplicity we can assume swapping the first and last item.
  • Append a record without a network call
  • Delete a record without a network call.

Doing these should automatically sync the data bindings/computed props

My data model after a peekAll call contains 10 records(shown below) on which I need to perform the above operations.

My model is as shown below

export default Model.extend({
  testId: attr('number'),
  name: attr('string')
});

enter image description here

What is the right approach to update the content record? Could someone please suggest how to proceed?

0 Answers
Related