2016-08-26 31 views
1

我想裁剪3張圖像,然後上傳他們使用Angular 2裁剪。 我集成Angular 2圖像裁剪器「ng2-img-cropper」,但我沒有得到它的工作。Angular 2 ng2-img-cropper沒有顯示組件

當我運行應用程序並進入裁剪器實現的頁面時,我只看到一個小圖像正方形,當我點擊或拖動它時沒有任何反應,並且控制檯中沒有錯誤。 Figure : Empty image square

我正在使用「[email protected]」。

這就是我如何進行實施。 我提到這個Github的鏈接https://github.com/cstefanache/angular2-img-cropper 我加入這個到HTML

<div> 
    <img-cropper [image]="data" [settings]="cropperSettings"></img-cropper><br> 
    <img [src]="data.image" [width]="cropperSettings.croppedWidth" [height]="cropperSettings.croppedHeight"> 
</div> 

而這個進級

import {ImageCropperComponent, CropperSettings} from 'ng2-img-cropper'; 

data: any; cropperSettings: CropperSettings; 

constructor() { 

    this.cropperSettings = new CropperSettings(); 
    this.cropperSettings.width = 100; 
    this.cropperSettings.height = 100; 
    this.cropperSettings.croppedWidth =100; 
    this.cropperSettings.croppedHeight = 100; 
    this.cropperSettings.canvasWidth = 400; 
    this.cropperSettings.canvasHeight = 300; 

    this.data = {}; 

} 

謝謝。

鏈接到這個問題Issue

回答