Closed sarath3940 closed 6 years ago
Hi! @sarath3940, of course it can
example:
...
<ly-cropping #cropping1 [config]="myConfig"></ly-cropping>
<button (click)="cropping1.crop()">crop 1</button>
<ly-cropping #cropping2 [config]="myConfig"></ly-cropping>
<button (click)="cropping2.crop()">crop 2</button>
<button (click)="cropAll()">crop All</button>
or
<button (click)="cropping1.crop();cropping2.crop()">crop All</button>
...
export class ResizingCroppingImagesExample01Component {
...
@ViewChildren(LyResizingCroppingImages) imgs: QueryList<LyResizingCroppingImages>;
...
ngAfterViewInit() {
this.imgs.forEach(img => console.log(img));
}
cropAll() {
this.imgs.forEach(img => img.crop());
}
}
Thank you! @alyleui. It worked. :)
Hi. As you specified: <button (click)="cropping1.crop();cropping2.crop()">crop All
".crop()" is an inbuilt method. Can I use a user defined method like:
<button (click)="cropping1.cropUser()">crop
Please let me know. I have tried doing that. And it's throwing an error.
".crop()" is an method of LyResizingCroppingImages
Could you create a method in your component
export class ResizingCroppingImagesExample01Component {
...
@ViewChildren(LyResizingCroppingImages) imgs: QueryList<LyResizingCroppingImages>;
...
ngAfterViewInit() {
this.imgs.forEach(img => console.log(img));
}
cropAll() {
this.imgs.forEach(img => img.crop());
}
cropImg1() {
this.imgs.first.crop();
}
cropImg2() {
this.imgs.last.crop();
}
}
<button (click)="cropImg1()">crop image 1</button>
<button (click)="cropImg2()">crop image 2</button>
IT WORKED. Thank you dude, once again. And thank's for your quick response.
Can I use angular2-resizing-cropping-image plugin for cropping two images, one at a time??