npm.io
0.0.2 • Published 3 years ago

@devenvy/ngx-cropperjs

Licence
—
Version
0.0.2
Deps
1
Size
28 kB
Vulns
0
Weekly
0

Angular Cropper.js Wrapper

This is meant to be a very simple wrapper for Cropper.js

Building the library

ng build lib

Running the demo app

ng build lib --watch   # (watch is optional, to auto rebuild while developing)
ng serve demo
Installing and usage
npm install cropperjs --save
npm install @devenvy/ngx-cropperjs --save
Add styles to angular.json
"yourApp": {
  "architect": {
    "build": {
      "options": {
        "styles": [
          "node_modules/cropperjs/dist/cropperjs.css"
        ]
      }
    }
  }
}
Load the module for your app:
import { CropperModule } from '@devenvy/ngx-cropperjs';

@NgModule({
  ...
  imports: [
    ...
    CropperModule
  ]
})
Use it in your HTML template:
<ngx-cropper
  source="https://fengyuanchen.github.io/cropperjs/images/picture.jpg"
  [options]="options">
</ngx-cropper>
Properties
property value
source the image source, can be a url or base64 data url
options See Cropper.js Options