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

Compatability with Ivy

Open JohnTranstel opened this issue 4 years ago • 14 comments

Trying to use 1.4.0 with angular 9 It does not like FileSelectDirective in the declaration or import sections of app.module. removing it then re-raises the issue Can't bind to 'uploader' since it isn't a known property of 'input'

Error message wonders if ng2-file-upload is compatible with Ivy

Is it?

JohnTranstel avatar May 13 '20 13:05 JohnTranstel

I'm having the same issue with:

ERROR in ../node_modules/ng2-file-upload/file-upload/file-upload.module.d.ts:1:22 - error TS- 
996002: Appears in the NgModule.imports of AppModule, but could not be resolved to an 
NgModule class

1 export declare class FileUploadModule {

Does version 1.4 solve the Ivy errors? I'm using 1.3...

ewwwgiddings avatar May 17 '20 03:05 ewwwgiddings

I see there's an Ivy folder in version 1.3 but again I get this error which is an error mentioned here: https://github.com/valor-software/ng2-file-upload/commit/2888f4cb1154cba8572de891c9511b021a453737

Anyone know how to get version 1.3.0 compatible with Ivy?

ewwwgiddings avatar May 17 '20 03:05 ewwwgiddings

Having same issue with Angular 9. Does anyone find any solution to this?

wcpmahmudul avatar May 18 '20 22:05 wcpmahmudul

Is this repo maintained by Valor or is it up to the community to fix issues like this?

ewwwgiddings avatar May 23 '20 17:05 ewwwgiddings

See also #1145, it looks like Valor made this project internal-only. There is a version 1.4.0 on NPM, but the code for it is not in this Github repository and the MIT license has been removed.

rhuitl avatar May 25 '20 08:05 rhuitl

Looks like they just left the README off the update.

It looks like version 1.4.0 isn't compatible with Angular 9 Ivy? Has anyone got it to work?

The latest commit here by @Domainv mentions update to Angular 8 in the description.

@rhuitl There's 70k weekly downloads from their npm. Would be surprised if they changed the licensing on that many people.

ewwwgiddings avatar May 25 '20 18:05 ewwwgiddings

Looks like they just left the README off the update.

It looks like version 1.4.0 isn't compatible with Angular 9 Ivy? Has anyone got it to work?

The latest commit here by @Domainv mentions update to Angular 8 in the description.

@rhuitl There's 70k weekly downloads from their npm. Would be surprised if they changed the licensing on that many people.

Still 1.4.0 does not work with angular 9.1, any update, please?

slcoder avatar Jul 28 '20 20:07 slcoder

I just did a giant switch to angular 10 and now this, a fairly core piece of my system, does not work. Help! At least give us access to to the 1.4.0 source code so that we can try and fix it ourselves! Please, give us something to go on here.

crowmagnumb avatar Sep 29 '20 00:09 crowmagnumb

I just did a giant switch to angular 10 and now this, a fairly core piece of my system, does not work. Help! At least give us access to to the 1.4.0 source code so that we can try and fix it ourselves! Please, give us something to go on here.

So you're in 10 with version 1.4 from npm and it doesn't work? Seeing some people say it works while others not...

ewwwgiddings avatar Sep 29 '20 00:09 ewwwgiddings

Oh gosh. I'm sorry. It was just a Firefox issue. It just won't respond to opening the file dialog with a click. It works fine in Chrome now I see. I've been having a lot of similar problems with my Firefox install lately so hopefully its just something on my end there. Sorry, I'm tired and need dinner, and I had the one problem, saw the thread here about it not working in Ivy and I panicked. :) Should have been more thorough.

crowmagnumb avatar Sep 29 '20 02:09 crowmagnumb

I'm currently in the process of upgrading one of my projects to Angular 10, and I just came here to make sure all my libraries are Ivy compatible or not. So is it compatible? Does it work with Angular 10? If not, is there any fork of this that works with Angular 10?

abdatta avatar Sep 29 '20 14:09 abdatta

For me, while I have not done extensive testing in any way shape or form, it appears to be, at least basically, working. I would of course make an upgrade branch to test before diving in deep.

crowmagnumb avatar Sep 29 '20 16:09 crowmagnumb

I haven't tried upversioning to 1.4, but 1.3 I managed to get it to work by just componentizing the uploader

                        <div ng2FileDrop
                             [ngClass]="{'nv-file-over': hasBaseDropZoneOver && baseDropZoneOverId == type.id}"
                             (fileOver)="fileOverBase($event, this.m.id)"
                             [uploader]="uploader">
                            <div>
                                <button class="btn btn-success" id="select_{{this.m.id}}" (click)="fileInput.click()" [class.btn-disabled-grey]="disableBtnSelect(m.id)" [disabled]="disableBtnSelect(m.id)">
                                    Select
                                </button>
                                <span class="hide-uploader-input">
                                    <input type="file" id="uploaderInput_{{this.m.id}}" #fileInput ng2FileSelect (change)="onFileChanged($event, m.id)" [uploader]="fileService.uploader" class="hide-uploader-input" />
                                </span>
                            </div>
                        </div>
//Controller added code
    uploader: any;
    hasBaseDropZoneOver: any;
    baseDropZoneOverId: any;
    type: any;
    fileOverBase: any;

And it seems to work in all ways as I would expect for Angular 9. I haven't done extensive testing, but it was basically a super naive hack solution for the compiler error in migration where those 5 "directive" properties were not known by Ivy. I don't know if this causes weird issues with having multiple uploaders or not, but the happy path test worked perfectly fine.

Prinsn avatar Apr 14 '21 16:04 Prinsn

I encountered this same error. I am using angular 13 with a shared module containing most of my modules. when i tried importing and adding it to this module. i encountered the error. I tried doing it in the app.module.ts and the error simply went away.

i hope this helps...###

this worked for me.

tonyblazesage avatar Oct 29 '22 15:10 tonyblazesage