imsky/holder — pull request #26 by ovax3 (2013-01-09 18:21:25+00:00)
Title: AngularJS workaround

This is a workaround to make holder work with AngularJS apps.

I'm not sure this is the best way to add this feature as I am both a new Angular and holder user.

The idea is to expose a method in the Holder global object that allows to process any given DOM img element, then use this method from a very short Angular directive which is called by the Angular framework during the link phase.

Usage

that's it. I named the Angular directive that way so that it can be included into the project [angular-strap](https://github.com/mgcrea/angular-strap).

The workaround currently only supports the src/data-src method. No regression test have been achieved to test if the regular way of using holder still work (as I have no project using it outside of my first Angular app). But should be ok as the patch is very simple (just moved code into a new method).

Here is the Angular directive source-code (which is not included in my pull request)

directive('bsHolder', function() {
return {
link: function (scope, element, attrs) {
Holder.process_img(element.get(0));
}
};
})