imageonload.js 411 B

1234567891011121314
  1. angular.module('app').directive('imageonload', ['$parse', function ($parse) {
  2. return {
  3. restrict: 'A',
  4. link: function (scope, element, attrs) {
  5. var fn = $parse(attrs.imageonload)
  6. element.bind('load', function (event) {
  7. scope.$apply(function () {
  8. fn(scope, {$event: event});
  9. });
  10. });
  11. }
  12. };
  13. }])