javascript - Angularjs directive not working with img tag -
i replace img tag independent of ng-src. if remove ng-src feature not working , if ng-src='/avatars/original/missing.png' feature not working. if ng-src="http://s3.amazonaws.com/avatars/xxxxxxxxxxxxx.xxx" works.
<img error-img object="target" data-color="#f37a5e" data-width="65px" data-height="65px" data-font-size="24px" ng-src="{{target.avatar_url}}" >
directive code
auditionuprofessor.directive 'errorimg', -> restrict: 'a' scope: object: '=' link: (scope, element, attrs) -> chars = "no-image" element.bind('error', -> element.replacewith($("<div class='missing-image' href='javascript:;'>#{chars}</div>") ) )
can help.
Comments
Post a Comment