-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow access to $contentfulEntries.includes #11
Comments
@mismith — The Behind the scenes, the directive queries the Contentful API, walks over all the linked resources in the items and resolves them with the data from the So the heavy lifting is already done for you automatically and you should already have all information available in the Does that make sense? Thanks! |
It totally does make sense and that's exactly what I figured it was doing, but I guess there must be some bug because this is failing for me using the latest (v2.0.0) build. I'll try to throw together a plunkr showing the problem when I get a sec. |
@mismith — A plnkr would be very useful indeed. Thanks in advance! |
Haha, I just spent 30 mins making a plunk before realizing that the code I was trying on Friday works this morning unchanged... I figured it must've been a bug in this library but now I'm leaning more towards some kind of service outtage on contentful's side? That would also explain why the Links were being pulled from the |
@mismith — Thanks for the update. No worries at all, feel free to re-open the issue if needed. Have a great day! |
Hmmm, it's happening again. Here's that plunk: http://plnkr.co/edit/Glk72SJH6Tn4ryqD58sp?p=preview I notice that the raw response from contentful doesn't seem to include the |
@mismith — Contentful does not include linked resources when querying for a single entry. It only includes linked resources when querying for multiple entries (even if only one entry is returned). From the Contentful documentation: A reason to query an Entry by ID instead of retrieving the Entry itself might be because you want to include resolved links. In terms of the Contentful API:
In terms of this library
As a workaround you can use the <section contentful-entries="'sys.id=some-id'">
{{ $contentfulEntries.items[0] }}
</section> In essence it is caused by the way the Contentful API works and not by the inner workings of this library. Does that explain the inconsistent behavior you are experiencing?
|
That totally explains it; sorry for my oversight. Thanks for this awesome library. |
@mismith — No problem, thank you for your feedback. Much appreciated! |
A link to this issue has been added to the README in case other people are wondering why they experience similar behavior. |
I don't know if this is a new change on contentful's part or not, but I see in the response packet from, say, a call like this
https://cdn.contentful.com/spaces/XXX/entries?access_token=XXX&content_type=XXX
now returns anincludes
property alongsideitems
, and it would be nice to be able to access that directly, in addition to continuing to auto-populate the linked ResourcesSample response:
The text was updated successfully, but these errors were encountered: