UNPKG

angular-croppie-module

Version:

Angular 2+ module for using [Croppie](https://foliotek.github.io/Croppie/).

56 lines (53 loc) 1.78 kB
import { Directive, Input, Output, ElementRef, EventEmitter, NgModule } from '@angular/core'; import * as Croppie from 'croppie'; import { CommonModule } from '@angular/common'; var CroppieDirective = /** @class */ (function () { function CroppieDirective(elementRef) { this.element = elementRef.nativeElement; this.update = new EventEmitter(); } CroppieDirective.prototype.ngAfterViewInit = function () { var _this = this; ((this.croppieOptions)).update = function (data) { return _this.update.emit(data); }; this.croppie = new Croppie(this.element, this.croppieOptions); }; CroppieDirective.prototype.ngOnDestroy = function () { if (!!this.croppie) { this.croppie.destroy(); } }; return CroppieDirective; }()); CroppieDirective.decorators = [ { type: Directive, args: [{ selector: 'img[croppieOptions]', exportAs: 'croppie' },] }, ]; CroppieDirective.ctorParameters = function () { return [ { type: ElementRef, }, ]; }; CroppieDirective.propDecorators = { "croppieOptions": [{ type: Input },], "update": [{ type: Output },], }; var CroppieModule = /** @class */ (function () { function CroppieModule() { } return CroppieModule; }()); CroppieModule.decorators = [ { type: NgModule, args: [{ imports: [ CommonModule ], declarations: [ CroppieDirective ], exports: [ CroppieDirective ] },] }, ]; export { CroppieDirective, CroppieModule }; //# sourceMappingURL=angular-croppie-module.js.map