ngCropper
ngCropper copied to clipboard
ngCropper doesn't work in Angular Modal
Hi there,
I use code from demo in angular modal view, however, the crop view doesn't show up when I upload a file. Is there any solution for this?
Thanks.
For more information, I use demo code and it has error like (In 'element.cropper(options)', 'element.cropper' is undefined)
It looks like the cropper is not initialized properly.
Hi, I had this issue before. What I want to do is to zoom in & zoom out with slider bar. So, I put my code in ngCropper directive. For example,
link: function(scope, element, atts) {
var shown = false;
scope.$on(scope.showEvent, function() {
if (shown) return;
shown = true;
preprocess(scope.options, element[0])
.then(function(options) {
setProxy(element);
/**
* Zoom in & Zoom out slidebar
**/
scope.$watch('zoomvalue', function(delta){
element.cropper('zoom', delta * 0.1);
});
element.cropper(options);
})
});
So it seems that this part
/**
* Zoom in & Zoom out slidebar
**/
scope.$watch('zoomvalue', function(delta){
element.cropper('zoom', delta * 0.1);
});
has to be placed before " element.cropper(options); "
Hi iceNuts,
You can workaround the problem, if you change element.cropper(options)
to $(element).cropper(options)
in the source. I actually had this issue and this fixed.