ng2-image-upload icon indicating copy to clipboard operation
ng2-image-upload copied to clipboard

ISSUE: Doesn't honour the "max" count

Open Manikkumar1988 opened this issue 6 years ago • 2 comments

In the html, configured <image-upload url="http://example.com" [headers]="myHeaders" [max]="6" buttonCaption="Upload xxx Pictures" dropBoxMessage="" [extensions]="['jpeg','png']" (removed)="onRemoved($event)" (uploadFinished)="imageFinishedUploading($event)" (uploadStateChanged)="onUploadStateChanged($event)" [uploadedFiles]="imageUrl"></image-upload>

But the UI elements allow more than 6 images to be uploaded!

Manikkumar1988 avatar Apr 25 '18 00:04 Manikkumar1988

@Manikkumar1988 I've found this too. However, if I use 0 rather than 1 (the desired actual upload count) then it works. I wonder if this simply checks the .length of the uploaded image array, meaning it counts one less.

Either way, if I use the [max] operator I get the following nativeElement error. Have you found this?

TypeError: Cannot read property 'nativeElement' of undefined
    at ImageUploadComponent.push../node_modules/angular2-image-upload/lib/image-upload/image-upload.component.js.ImageUploadComponent.deleteFile (image-upload.component.js:91)
    at Object.eval [as handleEvent] (ImageUploadComponent.html:49)
    at handleEvent (core.js:9953)
    at callWithDebugContext (core.js:11046)
    at Object.debugHandleEvent [as handleEvent] (core.js:10749)
    at dispatchEvent (core.js:7415)
    at core.js:7859
    at HTMLDivElement.<anonymous> (platform-browser.js:1140)
    at HTMLDivElement.i (<anonymous>:1:158173)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:3662)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:496)
    at invokeTask (zone.js:1540)
    at HTMLDivElement.globalZoneAwareCallback (zone.js:1566)

Taylorsuk avatar Aug 10 '18 06:08 Taylorsuk

I didnt face the issue you face! For now I handled upload count logic on my own.

Manikkumar1988 avatar Aug 12 '18 14:08 Manikkumar1988