-
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
Example only shows garbage #6
Comments
@iprognos — Can you post your markup and the result you get? For example: <ul contentful-entries>
<li ng-repeat="entry in $contentfulEntries.items">
{{ entry.fields.name }}
</li>
</ul> loops over all entries in your Contentful space, displaying the Can you post your JavaScript and HTML? Thanks! |
Now I have managed to show the Hemingway blog post: Get all entries
It shows the blog post and then 5 empty ones. This feel a bit wrong. But I am learning. |
This works: Result: Lewis Carroll |
I have to learn markdown to make code viewable.... Strange that one is working but not the last one. |
I am trying to understand what the id are so I can have a clickable list of Blog entries... |
@iprognos — Angular-contentful provides you with the data that is received from Contentful. You can read more about the JSON format right here on the Contentful website: https://www.contentful.com/developers/documentation/content-delivery-api/#json. There you can read on system properties ( That is how Contentful structures their documents and is not specific to angular-contentful. Hope that makes sense? Thanks! |
Yes, great! I am now strugling to get a drill down view of blog posts. I pass the somewhat no seo friendly Id to my details view: Then I run your directive: {{ $contentfulEntry }} And instead of a hardcoded ID I pass it dynamicly: {{ $contentfulEntry }} But I have not yet figured out the right syntax, I have tried with contentful-entry="{{id}}" and contentful-entry="({id})" and contentful-entry="id" and contentful-entry="{id}". The request to contentful is soething like this, you see whats wrong in the URL: |
Not able to pass it dynamicly. I have managed to pass the id succesfully to my details view and I have it in the scoope: $scope.id and I can view it in the details page with this: {{id}} . But I can not pass in the {{id}} in the contentful-entry handler. I have tried a lot of syntax on the id. I am used to pass in id this way: ui-sref=".detail({id: show.name})" |
@iprognos — If I were you I would resolve the entry in the route's
Then you get the
to make the entry accessible in your view.
Hope that helps! |
Yes that could be a way to do it. I did it this way: I have this in my ui-router: .state('app.blog.detail', { I have a blogDetailsController: app.controller('blogDetailsController', ['$scope','$stateParams', 'contentful', function($scope, $stateParams, contentful ) { And in my blog-detail.html I have: Get one entry{{ $contentfulEntry }} ID: {{id}} The problem now is that I can't get the body from the blog post: {{ $contentfulEntry.fields.createdEntries[0].fields.body }} Its not there. I have this in the $contentfulEntry: {"name":"Lewis Carroll","website":"http://en.wikipedia.org/wiki/Lewis_Carroll","profilePhoto":{"sys":{"id":"2ReMHJhXoAcy4AyamgsgwQ","type":"Link","linkType":"Asset"}},"biography":"Charles Lutwidge Dodgson (27 January 1832 – 14 January 1898), better known by his pen name, Lewis Carroll, was an English writer, mathematician, logician, Anglican deacon and photographer. \n\nHis most famous writings are Alice's Adventures in Wonderland, its sequel Through the Looking-Glass, which includes the poem Jabberwocky, and the poem The Hunting of the Snark, all examples of the genre of literary nonsense. \n\nHe is noted for his facility at word play, logic, and fantasy. There are societies in many parts of the world (including the United Kingdom, Japan, the United States, and New Zealand[3]) dedicated to the enjoyment and promotion of his works and the investigation of his life. In 1982, his great-nephew unveiled his memorial stone in Poets' Corner, Westminster Abbey.","createdEntries":[{"sys":{"id":"1asN98Ph3mUiCYIYiiqwko","type":"Link","linkType":"Entry"}}]} |
@iprognos — Ah, if your entry has links to other entries, you should resolve them. However, if you use So can you try to use something like
|
Ah ok, I will try that. I did not know the syntax for the query string so I avoided it. |
Puh.. Got it working: blogdetails.controler.js: app.controller('blogDetailsController', ['$scope','$stateParams', 'contentful', function($scope, $stateParams, contentful ) {
blogdetail.html: Directives demoThis simple demo uses the following Contentful configuration: Get one entry{{ $contentfulEntries.items[0].fields.createdEntries[0].fields.body}} |
Is it possible to get an entry by slug instead of ID, it´s not very SEO friendly to have a ID in the URL? I searched the API documentation and could not find any comprehensible. Then I tried with: .entries('fields.slug=down-the-rabbit-hole') but of course it did not work. |
@iprognos — Yes, you can specify a query string like:
You can see the exact documentation right here. Let me know if it works, ok? |
No does not work. query=all works best, then I get three entries and avoid listing categories and authors. |
Closed, continued in #7. |
I have implemented the all content example:
{{ $contentfulEntries.total }} items found:
There is only a list of garbage. How do I get some actual content from this?
The text was updated successfully, but these errors were encountered: