Git Product home page Git Product logo

Comments (5)

koorgoo avatar koorgoo commented on July 17, 2024

Hi. You can use proxing, see demo.js for example.
On Aug 21, 2015 10:52 PM, "jrbecart" [email protected] wrote:

Like in the cropper website example, how can I do for example:
$().cropper("getCroppedCanvas", { width: 160, height: 90 })
with ngCropper?


Reply to this email directly or view it on GitHub
#16.

from ngcropper.

jrbecart avatar jrbecart commented on July 17, 2024

I don't understand how to use the proxy:

$scope.cropperProxy = 'cropper.getCroppedCanvas';
And after...? Sorry if it's a dumb question.

from ngcropper.

koorgoo avatar koorgoo commented on July 17, 2024

Ok.
First you should define a proxy name in $scope.

$scope.cropper = {}; // This is a container object.
$scope.cropperProxy = 'cropper.first'; // This means that your proxy will be set to $scope.cropper.first

Then you should pass $scope.cropperProxy to directive via attribute in html.

<img ng-cropper ng-cropper-proxy="cropperProxy" ...>

The directive will set cropper function to $scope.cropper.first - $scope.cropper.first() equals element.cropper().
Finally $scope.cropper.first('getCroppedCanvas', { width: 160, height: 90 }) is what you need.

from ngcropper.

koorgoo avatar koorgoo commented on July 17, 2024

Working with DOM in controller is a bad practice. Anyway in some cases we must do it.
I agree that proxing is really a bit tricky 😃

from ngcropper.

jrbecart avatar jrbecart commented on July 17, 2024

Thanks!

from ngcropper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.