I want to replace all broken img url with a default when the broken url does not exists with AngularJS jqlite attr()
. I use it like this but won't work.
var app = angular.module('app');
app.controller('AdminCtrl',function($scope{
angular.element(document.querySelector('img')).attr("onerror","this.src='../assets/img/broken/broken-link.png'");
})
What is correct script?