-
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
Retrieving an image as a directive #18
Comments
@vergarm — You can access an image right from the Contentful data indeed, e.g.: <ul contentful-entries="content_type=dog">
<li ng-repeat="dog in $contentfulEntries.items | orderBy:'fields.name' ">
<h1>{{ dog.fields.name }}</h2>
<img ng-src="{{ dog.fields.image.fields.file.url }}" />
</li>
</ul> |
@jvandemo - can i access the image without looping? |
@vergarm — Yes, you should be able to do something like: <div contentful-entry="'6KntaYXaHSyIw8M6eo26OK'">
<img src="{{ $contentfulEntry.fields.image.fields.file.url}}"
</div> where <div contentful-entry="'6KntaYXaHSyIw8M6eo26OK'">
<img src="{{ $contentfulEntry.fields.avatar.fields.file.url}}"
</div> Does that make sense? Thanks! |
Thanks! that worked :-) |
@vergarm — Super, thank you for the confirmation. |
@jvandemo - is it possible to retrieve an image from contentful as a directive or do i have to use the service for that? Thanks!
<img contentful-entry="'6KntaYXaHSyIw8M6eo26OK'" src="$contentfulEntry.fields.url"/>
The text was updated successfully, but these errors were encountered: