ng-holder icon indicating copy to clipboard operation
ng-holder copied to clipboard

use attr.$observe

Open RopoMen opened this issue 9 years ago • 2 comments

Hi,

this fixes case where ngSrc directive is used and 'src' property is not yet interpolated -> holder.js cannot show any image.

attrs.$observe('src', function(value) { Holder.run({images:element[0]}); });

// example ctrl function($scope) { $scope.myHolder = 'holder.js?200x200'; }

// example directive ( without $observe holder.js cannot display image, because 'src' attribute is not ready yet) <img ng-src="{{myHolder}} />

RopoMen avatar Sep 23 '15 07:09 RopoMen

Do you need to use the ngSrc directive? Don't both of these methods let you lazily set the path?

<img holder="holder.js/200x200/text:?">
<img holder data-src="holder.js/200x200/text:?">

It's been a while since I wrote this directive, but I thought the point of using data-src was to avoid these issues with src.

joshvillbrandt avatar Sep 25 '15 06:09 joshvillbrandt

Those probably work ok, but my placeholder image sources are coming from RESTful API and angular view template contains final code, meaning that I don't have data-src over there, instead ng-src.

RopoMen avatar Sep 25 '15 06:09 RopoMen