wKoza / ngx-upload

Ngx-upload is an upload module for Angular Ivy ready
30 stars 15 forks source link

Error on dependency injection #64

Closed kKen94 closed 5 years ago

kKen94 commented 5 years ago

Hi!

I know, mantain angular8 with and without Ivy is an aweful work.

Now, with Ivy, library works like a charm.

But without Ivy this is the error in DI:

" Can't resolve all parameters for *Component in path: (?) "

kKen94 commented 5 years ago

https://github.com/angular/angular/issues/31990 here there is opposite error. I Don't know if it is an angular or library issue

wKoza commented 5 years ago

hmm, I know that the library works fine with Angular 7 and Angular 8 with Ivy. I'll try with Angular 8 ... But Angular 8 has a lot of bugs ...

kKen94 commented 5 years ago

😂😂😂 I know

wKoza commented 5 years ago

It should be okay with the version 8.0.3. There is a example here. I use Angular 8.2 ...

Can you confirm ?

kKen94 commented 5 years ago

I also use angular 8.2 It is probably an angular error

wKoza commented 5 years ago

Are you tested my last release (8.0.3) ? I've no more error with or without ivy.

kKen94 commented 5 years ago

I do it now and the error is

image

This the declaration:

image

And this the usage:

image

image

wKoza commented 5 years ago

There is a example here. You can also give me a minimal repro.

kKen94 commented 5 years ago

I saw the repo, i can't found the reason of the error. I'm seeing that you have uploaded a new version, i'll try it

wKoza commented 5 years ago

Hi @kKen94 , Have you resolved your problem ?

wKoza commented 5 years ago

I suppose we can close this issue. You can create a new issue whether your problem persists.

kKen94 commented 5 years ago

Sorry, I was on vacation.

It is my problem. I don't understand why, but the same code in a new project works, in this project no. 🤷🏻‍♂️

kKen94 commented 5 years ago

Have you tried with an application that use NgxUpload in a sub route? I explain myself:

I resolve this bug both importing NgxUploadModule.forRoot() in app.module and in my sub module.

wKoza commented 5 years ago

Your sub module is lazy loaded ?

kKen94 commented 5 years ago

Yes. And with previous version it works

wKoza commented 5 years ago

Normally, you have to import NgxUploadModule.forRoot() in your AppModule and NgxUploadModulein your sub module. I don't have to call forRoot in a sub module. It's a convention lirectly linked to Angular. You can take a look at this repo.

kKen94 commented 5 years ago

So why did it work with the old version?

wKoza commented 5 years ago

NgxUpload v8 come with some changes (I use providedIn: 'root' now). So you may have a conflict with the providers. (If you use forRoot() in a sub module, yours services will not be singleton and the behavior is not predictive). Maybe , the new Angular's injector is less permissive ...

alecoexposito commented 5 years ago

You guys need to update your docs, this error was driving me crazy. Other than that great work, great plugin, keep it up.

wKoza commented 5 years ago

done