AngularJS – Image “onload” event
Here’s a re-usable directive in the style of angular’s inbuilt event handling directives: angular.module(‘sbLoad’, []) .directive(‘sbLoad’, [‘$parse’, function ($parse) { return { restrict: ‘A’, link: function (scope, elem, attrs) { var fn = $parse(attrs.sbLoad); elem.on(‘load’, function (event) { scope.$apply(function() { fn(scope, { $event: event }); }); }); } }; }]); When the img load event … Read more