-
-
Notifications
You must be signed in to change notification settings - Fork 241
aot - platform specific files angular dependency injection bug #1334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
here is an project example - https://play.nativescript.org/?template=play-ng&id=Gih9oD Be sure to Download the project and run it with |
@shabib3 I faced the same problem before. For now , it seems platform specific files with .android or .ios are only supported for For First, create typescript definition file, say, itemsListWithIconsModalDialogHelperLogic.d.ts.
Then, separete your platform specific logic from @Injectable file into two files, for instance,
Finally, import the logic class from one itemsListWithIconsModalDialogHelper.ts in which you will have @Injectable.
Folder structure:
Thanks. |
@hosikiti - Thank you for the long suggestion! I tried it and I get the same error...any idea? |
@shabib3 You're welcome. Problem is you have two @Injectable classes. Instead, you need to have only |
Ohhh! Gotcha!! Awesome workaround! didn't think about it :) Thanks you! |
btw, I got to pass the |
Hi,
I searched some for this issue I have and the only thing I found is this, but this actually didn't help cause I already implements the solution there by @sis0k0
The issue is that when I run the project with
--env.aot
flag something happened to the dependency injection of the platform specific files, and I will give an example:I created a ModalDialogHelper for every modal dialog I have to simplify the creation of the dialog, because there is some cases that I want to have a different UI dialog for every specific platform I separate it to different platform specific files, so it looks kind of like this:
itemsListWithIconsModalDialogHelper.d.ts
:itemsListWithIconsModalDialogHelper.android.ts
:itemsListWithIconsModalDialogHelper.ios.ts
:The actual thing that matter in this sample is the line
return this._modalService.showModal...
in theitemsListWithIconsModalDialogHelper.android.ts
file, because there you can see that thethis._modalService
is undefined, something with the dependency injection I guess...this issue doesn't happens if I run it only with
--bundle
flag.The example show you that this is problem in the
android specific file
but it happens also in theios specific file
.Thank you! :)
The text was updated successfully, but these errors were encountered: