Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Ember Data - How to occasionally fulfill belongsTo/hasMany

$
0
0

@willwile4 wrote:

Hi All. I’m working on something and our api responses sometimes have data depending on certain attributes or if a user bothered to fill out the form at all. I’ve run into an issue trying to build out these as belongsTo/hasManys because if the response is empty, ember data can’t read property id of null.

example response:

thing: { thingId: 1, name: “thing 1”, thingDetails : { } }

Then in the serializer I simply use the EmbeddedRecordsMixin and set the attrs,

attrs : { thingDetails: { embedded: “always”, async: false } }

So my question is short and sweet, how do you configure the EmbeddedRecordsMixin to fulfill the relationship for thingDetails, only when thingDetails is not empty? Is this just a matter of creative error handling?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles