0

I am using ionic to create a mobile app.

I have a list of items and each item has a photo in it.

in my angular template for each item i have:

<img src='http://www.example.com/images/listings/{{listing.id}}/thumb.jpg'>

i use ng-repeat='listing in listings' to display the template.

i keep seeing angular makes one call to the non parsed url first but for each row gets the right image and displays it:

so first it tries getting

http://www.example.com/images/listings/{{listing.id}}/thumb.jpg

not parsing {{listing.id}}.

but then it parses correctly and displays the image correctly in the list:

http://www.example.com/images/listings/3523/thumb.jpg

so if i have a list of 15 items, it makes one call non-parsed {{listing.id}} and 15 calls correctly parsed.

how do i stop this from happening?

1 Answer 1

2

You should be using ngSrc instead of using the interpolation directly.

<img ng-src='http://www.example.com/images/listings/{{listing.id}}/thumb.jpg'>
Sign up to request clarification or add additional context in comments.

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.