Created
May 26, 2017 09:45
-
-
Save ColdFire87/5ce2b7a613776ba2203172d36959e0f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- for example --> | |
<img ng-src="{{ flaky.image }}" ng-error="tellServerItsBroken(this)"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FROM https://github.com/angular/angular.js/issues/8759 | |
angular.module('app') | |
.directive('img', function () { | |
return { | |
restrict: 'E', | |
link: function (scope, el, attr) { | |
el.on('error', function () { | |
if (attr['ngError']) { | |
scope.$eval(attr['ngError']) | |
} | |
}) | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment