I'm trying to use the ElevateZoom jQuery plugin inside an angular app.
Essentially, to use ElevateZoom normally, you create an image as follows:
<img id=my-img src=small.jpg data-zoom-image=big.jpg />
Then in your application JS:
$('#my-img').elevateZoom(options);
This works fine in a standard app. But when I try and do it in my AngularJS app using a directive (I followed some SO answers for getting jquery plugins into angular with directives) I just can't make it work.
Live editable demo on Plunkr: http://plnkr.co/edit/Mu4EOcGtGs7XVDDUvnnB?p=preview
My directive looks like:
app.directive('ngElevateZoom', function() {
return {
restrict: 'A',
scope: true,
compile: function(scope, element, attrs) {
$(element).elevateZoom(scope.$eval(attrs.elevateZoom));
}
};
});
And my HTML looks like this:
<img ng-elevate-zoom ng-src={{small_image}} data-zoom-image={{large_image}} />
What am I doing wrong? I've only been experimenting with Angular a few days so go easy on me ;)