I want use cropper.js (https://github.com/fengyuanchen/cropperjs) to create an Angular2 cropper with angular-cli.
My directive is:
import {Directive, ElementRef, Input, OnInit} from '@angular/core';
import Cropper from 'cropperjs';
@Directive({
selector: '[ng2-cropper]'
})
export class Ng2CropperJsDirective implements OnInit {
@Input('options') options: any = {};
private cropper;
constructor(private _element: ElementRef) { }
ngOnInit(): void {
console.log(Cropper);
this.cropper = new Cropper(this._element.nativeElement, this.options);
}
}
The error from ng serve
is: Cannot find module 'cropperjs'
But cropperjs is in node_modules
and my angular-cli.json
is updated with:
"scripts": [
"../node_modules/cropperjs/dist/cropper.js"
],
I do not have any ideas to solve the problem..