I am trying to serialize my payload from server, but it is not working.
Here is an example of my payload:
events:[{
id: "57f358856c616cf434fd0500"
annotations:[{_id: "57f358856c616cf434ff0500", desc: "hello world"}]
}]
I want to change annotations _id to id.
Here is my serializer:
//event.js
export default ActiveModelSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs:{
annotations:{embedded:'always'}
}
});
//annotation.js
export default ActiveModelSerializer.extend(DS.EmbeddedRecordsMixin,{
attrs:{
id: '_id',
},
});
Even though I am using DS.EmbeddedRecordsMixin
, it still doesn't work. Can anyone help me please? Thank you.
Aucun commentaire:
Enregistrer un commentaire