TypeError: Cropper is not a constructor
See original GitHub issueHey,
First thx for the amazing library.
I tried to update my Ionic2/Angular2 project from Cropperjs 0.7.2 (who works like a charm) to the last version of Croppersjs 0.8.1.
After this updated I’m now facing at runtime the following error:
browser_adapter.js:84 EXCEPTION: TypeError: Cropper is not a constructor
Could you please help me to fix the problem?
My code
<div id="preview" *ngIf="imgURI != null">
<img (load)="imageLoaded()" [src]="imgURI" #imageSrc>
</div>
import * as Cropper from 'cropperjs';
....
@ViewChild('imageSrc') input: ElementRef;
....
imageLoaded() {
this.cropper = new Cropper(this.input.nativeElement, {
viewMode: 3,
aspectRatio: 1 / 1,
dragMode: 'move',
modal: true,
guides: false,
highlight: true,
background: true,
autoCrop: true,
autoCropArea: 0.9,
responsive: true,
crop: (e:any) => {
}
});
}
also not, I use the typings typescript definition (dt~cropperjs)
Thx in advance
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:27 (1 by maintainers)
Top Results From Across the Web
Error while initializing cropper.js - Stack Overflow
Cropper statement.when i reload the page i got another error Uncaught TypeError: Cropper is not a constructor.but in this way only they are ......
Read more >Javascript – Error while initializing cropper.js - iTecNote
var Cropper = window.Cropper statement.when i reload the page i got another error Uncaught TypeError: Cropper is not a constructor.but in this way...
Read more >cropper is not a constructor
TypeError: Cropper is not a constructor #94. Closed And import * as Cropper from 'cropperjs'; gives the its not a constructor . This...
Read more >TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >cropperjs - npm
Just hold the Shift key when you crop on the image. Notes. The size of the cropper inherits from the size of the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, I had to import it via
import Cropper = require('cropperjs');. It’s working now.Or