Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

ngCropper doesn't work in Angular Modal #25

Open
iceNuts opened this issue Dec 28, 2015 · 3 comments
Open

ngCropper doesn't work in Angular Modal #25

iceNuts opened this issue Dec 28, 2015 · 3 comments

Comments

@iceNuts
Copy link

iceNuts commented Dec 28, 2015

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.

@iceNuts
Copy link
Author

iceNuts commented Dec 29, 2015

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.

@Five-stars-Coffee
Copy link

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); "

@pankyka
Copy link

pankyka commented Mar 22, 2016

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants