question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image src attribute causes a 404 before the compilation

See original GitHub issue

Hello,

with a template like this: <img src="{{image}} />

and javascript:

var vue = new Vue({
    el: '#view',
    data: {
        image: 'http://somehost.com/image.jpg'
    }
});

gives the error:

GET http://myhost.com/%7B%7Bthumb%7D%7D 404 (Not Found)

The Angular team had some issue with it, which resulted in the ngSrc directive. NB: The same problem might happen with the href attribute, see ngHref as well.

Edit: Here comes the JSFiddle.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:1
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

24reactions
yyx990803commented, Feb 12, 2014

You can use v-attr="src: image" in this situation

12reactions
ryantbrowncommented, May 15, 2016

@dickyeka the v-bind:src (or :src) evaluates an expression, you would need the following:

<img :src="'img/category/'+c.image" />

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error 404 on img src can't replace image - vanilla JS
The API returns a value for serials.Poster meaning the if statement always sets imgSrc to serials.Poster . The 404 message means the image...
Read more >
Show a default image if image is not found using JavaScript
If you set the image's src attribute to a non-existent image, it would re-trigger the error event, causing an infinite loop.
Read more >
Troubleshoot content issues - HubSpot Knowledge Base
Published content is displaying a 404 error. When no live page exists at the URL entered in the browser's address bar, the browser...
Read more >
onerror Event - W3Schools
The onerror event is triggered if an error occurs while loading an external file (e.g. a document or an image). Tip: When used...
Read more >
Static files in ASP.NET Core | Microsoft Learn
Run();. UseDefaultFiles must be called before UseStaticFiles to serve the default file. UseDefaultFiles is a URL rewriter that doesn' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found