Last active
November 3, 2017 14:25
-
-
Save kmaida/17eb24221d46152384ef to your computer and use it in GitHub Desktop.
AngularJS image onload directive
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
app.module['myApp'].directive('imageOnload', function() { | |
return { | |
restrict: 'A', | |
link: function(scope, element, attrs) { | |
element.bind('load', function() { | |
// call the function that was passed | |
scope.$apply(attrs.imageOnload); | |
// usage: <img ng-src="src" image-onload="imgLoadedCallback()" /> | |
}); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I dont think this would work in IE, its happening with me .Can you provide any better for IE?