GithubHelp home page GithubHelp logo

Comments (8)

jvandemo avatar jvandemo commented on June 3, 2024

Hi @fredrik-sogaard — Currently only literal strings are supported, not expressions.

You can use the contentful.entry(id) method to fetch a single entry if you need to do so programmatically.

Please let me know if you feel expressions are needed in the directive.

I am considering adding expression support but since that is a breaking feature, I will have to release a v2.0.0 for that.

Thanks for your feedback!

from angular-contentful.

jvandemo avatar jvandemo commented on June 3, 2024

Hi @fredrik-sogaard — I have just released v2.0.0 with support for expressions in the development branch: https://github.com/jvandemo/angular-contentful/tree/development

In v2.0.0 you can use expressions by default:

<div contentful-entry="eventId">{{ $contentfulEntry | json }}</div>

and use literals if you want to specify a string:

<div contentful-entry="'some-literal-id'">{{ $contentfulEntry | json }}</div>

Can you try it out and let me know if it works for you?

Thanks!

from angular-contentful.

fredrik-sogaard avatar fredrik-sogaard commented on June 3, 2024

Thanks! That was fast!

One thing I found: I can't access the file url of a linked asset from an entry? I only have access to the "sys" fields.

from angular-contentful.

jvandemo avatar jvandemo commented on June 3, 2024

Hi @fredrik-sogaard,

That is the default behavior of Contentful (see https://www.contentful.com/developers/documentation/content-delivery-api/#search-link).

You can specify the levels of resolved content like this:

<pre contentful-entry="'sys.id=6KntaYXaHSyIw8M6eo26OK&include=3'">
  {{ $contentfulEntry | json }}
</pre>

Can you try and verify if this works for you? Thanks!

from angular-contentful.

fredrik-sogaard avatar fredrik-sogaard commented on June 3, 2024

Thanks a lot for your replies. Really appreciate it!

Angular-contenful normally auto resolves links, so I thought perhaps it would also do it in this case. Because if I just get all the contentful entries, I can get the image url directly.

Den 17. jun. 2015 kl. 08.33 skrev Jurgen Van de Moere [email protected]:

Hi @fredrik-sogaard,

That is the default behavior of Contentful (see https://www.contentful.com/developers/documentation/content-delivery-api/#search-link).

You can specify the levels of resolved content like this:

  {{ $contentfulEntry | json }}

Can you try and verify if this works for you? Thanks!


Reply to this email directly or view it on GitHub.

from angular-contentful.

jvandemo avatar jvandemo commented on June 3, 2024

@fredrik-sogaard — Correct, when querying for multiple entries, this happens automatically. That is how the Contentful API works.

I have added documentation to the README to hopefully avoid confusion for others if they are in a similar situation.

Thanks for your feedback. I will close this issue but if you feel you have additional feedback, please don't hesitate to add it here. Thanks!

from angular-contentful.

fredrik-sogaard avatar fredrik-sogaard commented on June 3, 2024

Hi @jvandemo,

I have one small problem with this. Let me try to explain:

I set the eventID in the controller like this: $scope.eventId = $stateParams.eventId + '&include=1';

Which in turn I can log out and get 4DSqMNTzeMKGSgi6ckGQ60&include=1 as I would expect and everything seems to work.

But if I look in my network tab in web inspector I see this request: https://cdn.contentful.com/spaces/osmot86btiv3/entries?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxx&include=1 (access token redacted here)

This results in that every item in my list of events gets the same data.

If I remove &include=1 from the controller I get this (correct) request: https://cdn.contentful.com/spaces/osmot86btiv3/entries/4DSqMNTzeMKGSgi6ckGQ60?access_token=xxxxxxxxxxxxxxxxxxxxxxxx

Any idea of what's going on here?

from angular-contentful.

jvandemo avatar jvandemo commented on June 3, 2024

What does your template look like @fredrik-sogaard? Thanks!

from angular-contentful.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.