angular2-img-cropper
angular2-img-cropper copied to clipboard
Image cropper with src
Can image cropper have an src attribute , so we can set default image or background?
Here is what I use to set the cropperImage default image (maybe this helps you). This example works with an image url (eg. https://test.at/test.jpg).
` @ViewChild('imageCropper', undefined) imageCropper: ImageCropperComponent;
ngAfterViewInit() { let image: HTMLImageElement = new Image(); // lets you use the parent scope (of your Component) let that = this; image.onload = function() { that.imageCropper.setImage(image); }; // fires onload function image.src = imageUrl; // your default imageUrl } `
Appreciate.