Nico Hernandez Torres Nico Hernandez Torres - 2 months ago 6
AngularJS Question

ng-src not load data from params

I'm trying setear an image of a product coming ng-repeat. If the parameter is empty ng-repeat, we charge a local image by default. But when the value is correct, it does not print.

<div class="item item-avatar">
<img class="full-image" ng-src="{{(torneo.torneo_coordinador_imagen != '') ? 'data:image/jpeg;base64,torneo.torneo_coordinador_imagen' : './img/sin_afiche.png'}}">
</div>

Answer

Try separating the variable out of the string:

<div class="item item-avatar">
  <img class="full-image" ng-src="{{(torneo.torneo_coordinador_imagen != '') ? 'data:image/jpeg;base64,' + torneo.torneo_coordinador_imagen : './img/sin_afiche.png'}}">
</div>