4
<img lass="img-circle" src="{{p.CharmType | enumCharmUrl}}">

When having an image above in angular i get an error thrown if there is a brief moment when that variable is not available and it throws this error in the site console.

http://localhost:2087/%7B%7Bp.CharmType%20%7C%20enumCharmUrl%7D%7D 404 error

What is the best way to avoid this happening until this url is available.

Thanks

1
  • You have a type-o in "<img class...". Also, localhost url works only on your environment. Commented Jan 14, 2016 at 18:12

2 Answers 2

9

use ng-src INSTEAD of src

same applies to href

use ng-href INSTEAD of href

This applies whenever there is an expression in the src or the href

An expression being the bit in double curly brackets :)

Sign up to request clarification or add additional context in comments.

Comments

5

Just use ng-src instead of src:

<img lass="img-circle" ng-src="{{p.CharmType | enumCharmUrl}}">

ngSrc

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.