Code Monkey home page Code Monkey logo

angular-croppie's Introduction

angular-croppie-module

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.

angular-croppie's People

Contributors

angular-cli avatar

Watchers

James Cloos avatar

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.