Skip to content

Instantly share code, notes, and snippets.

View Samshal's full-sized avatar
👨‍💻

Samuel Adeshina Samshal

👨‍💻
View GitHub Profile
@dprea
dprea / ng-src-onerror.js
Created January 10, 2016 02:21
Angular ng-src onerror such as image resolves to a broken src
/**
* First is the Angular Directive method of solving.
* Second is the inline onerror fix that results in a default image.
* SOURCE: http://stackoverflow.com/questions/27549134/angularjs-ng-src-condition-if-not-found-via-url
*/
var myApp = angular.module('myApp',[]);
myApp.directive('onErrorSrc', function() {
return {