Image cropping plugin

Here how I proceeded:

  1. Install cropperjs (*** Update: Install version 0.7.2. Later version, like 0.8.1, doesn’t seems to be compatible anymore with my “how to”)

    sudo npm install cropperjs --save

  2. Install the typescript definition for cropperjs

    typings install dt~cropperjs --save --global

  3. In your ts class file, include cropperjs

    import * as Cropper from ‘croppers’;

  4. And finally declare a cropper variable in your class

    private cropper:cropperjs.Cropper;

  5. (Update) Also don’t forget to include the cropperjs css file in your project otherwise the cropperjs element not gonna be displayed correctly at runtime. Therefor add in your app.core.scss

    @import “cropper.scss”;

For the rest you could go on with my previous post.

2 Likes