fileChangeListener($event) {
debugger
var image: any = new Image();
var file: File = $event.target.files[0];
var myReader: FileReader = new FileReader();
var _this = this;
myReader.onloadend = function (loadEvent: any) {
image.src = loadEvent.target.result;
_this.cropper.setImage(image);
when I tag use in the page then it works very good. but when display in model Popup then tag in image not display.
I'm using this component inside ng-bootstrap Model. The image data is obtained from a file upload and then I try to init the cropper inside the modal.
this is my code.
<ng-template #content let-c="close" let-d="dismiss">
fileChangeListener($event) { debugger var image: any = new Image(); var file: File = $event.target.files[0]; var myReader: FileReader = new FileReader(); var _this = this; myReader.onloadend = function (loadEvent: any) { image.src = loadEvent.target.result; _this.cropper.setImage(image);
}