UNPKG

angular-croppie-module

Version:

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

89 lines (83 loc) 2.08 kB
import { Directive, Input, Output, ElementRef, EventEmitter, NgModule } from '@angular/core'; import * as Croppie from 'croppie'; import { CommonModule } from '@angular/common'; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Basic directive for creating Coppie instance on `<img>` tag. */ class CroppieDirective { /** * @param {?} elementRef */ constructor(elementRef) { this.element = elementRef.nativeElement; this.update = new EventEmitter(); } /** * @return {?} */ ngAfterViewInit() { (/** @type {?} */ (this.croppieOptions)).update = (data) => this.update.emit(data); this.croppie = new Croppie(this.element, this.croppieOptions); } /** * @return {?} */ ngOnDestroy() { if (!!this.croppie) { this.croppie.destroy(); } } } CroppieDirective.decorators = [ { type: Directive, args: [{ selector: 'img[croppieOptions]', exportAs: 'croppie' },] }, ]; /** @nocollapse */ CroppieDirective.ctorParameters = () => [ { type: ElementRef, }, ]; CroppieDirective.propDecorators = { "croppieOptions": [{ type: Input },], "update": [{ type: Output },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class CroppieModule { } CroppieModule.decorators = [ { type: NgModule, args: [{ imports: [ CommonModule ], declarations: [ CroppieDirective ], exports: [ CroppieDirective ] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /* * Public API Surface of angular-croppie-module */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ export { CroppieDirective, CroppieModule }; //# sourceMappingURL=angular-croppie-module.js.map