0.0.7 • Published 6 years ago

@noardsl/angular-croppie-module v0.0.7

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

angular-croppie-module

Repo forked from https://github.com/gatimus/angular-croppie

Angular 2+ module for using Croppie.

Getting Started

Based on @angular/cli project.

npm install --save angular-croppie-module croppie
npm install --save-dev @types/croppie

Add "../node_modules/croppie/croppie.css" to .angular-cli.json's "styles": [...].

Usage

Basic directive for creating Coppie instance on <img> tag.

app.module.ts

import { CroppieModule } from 'angular-croppie-module';

@NgModule({
    imports: [
        CroppieModule
    ]
})
export class AppModule { }

app.component.html

<img #croppie="croppie" [croppieOptions]="croppieOptions" (update)="handleUpdate($event)" />

app.component.ts

import { CroppieOptions } from 'croppie';
import { CroppieDirective } from 'angular-croppie-module';

@Component({
    ...
})
export class AppComponent implements AfterViewInit {

    public croppieOptions: CroppieOptions = {
        // https://foliotek.github.io/Croppie/#documentation Options
        ...options
    };

    @ViewChild('croppie')
    public croppieDirective: CroppieDirective;

    public ngAfterViewInit() {
        // https://foliotek.github.io/Croppie/#documentation Methods
        this.croppieDirective.croppie...
    }

    public handleUpdate(data) {
        // https://foliotek.github.io/Croppie/#documentation Events update
        data // -> { points: number[], zoom: number }
    }

}

See demo/app/croppie.component.ts for material looking croppie component.

0.0.7

6 years ago

0.0.6

6 years ago