I need to check if an async relationship has been loaded without triggering the load, is this possible?
After time has passed, Ember Data 2.5 got released. One of implemented features is the ds-references
feature.
The references API allows to interact with your relationships. With it, it is possible to check if your RelationshipName
is already loaded, without triggering a request:
model.hasMany('yourRelationshipName').value() !== null;
With ember-data 1.13, the following will work for a hasMany
relationship. Still a hack, but there does not seem to be a public API.
var relationships = model._internalModel._relationships.initializedRelationships;
if (relationships.yourRelationshipName.manyArray.get('isLoaded')) {...}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With