I have a div with an image:
<div ng-if="showIt">
<img src="{{filepath}}/{{filename}}">
<!-- ... and a bunch other other elements -->
</div>
The thing is {{filepath}} and {{filename}} will be null if showIt is false.
However, I always see a 404 error in my console because I think Angularjs is rendering the whole DOM, and then removing the bits where ng-if evaluates to false. This means the browser will always request the non-existent images even when showIt is false.
Is there a way prevent the DOM from creating that entire div block, so that the non-existent images will never be requested by the browser?