GreenFlag31 / modal-library

ngx-modal-ease is a versatile Angular library providing a lightweight, simple, and performant modal.
https://greenflag31.github.io/modal-library/
13 stars 2 forks source link

Pass injector #6

Open jerome-aluffi-perso opened 1 week ago

jerome-aluffi-perso commented 1 week ago

Hi,

Is possible to pass the parent injector in the options ? ` export class YComponent { injector = inject(Injector); modalService = inject(ModalService); .... showModal() {

this.modalService.open(XXModalComponent, { injector: this.injector } ); }

}`

Best regards,

GreenFlag31 commented 1 week ago

This injector will then be used in the injected component, right? Then you can pass it in the data option:

this.modalService.open(XXModalComponent, {
...
data: {
     injector: this.injector
  }
}
jerome-aluffi-perso commented 1 week ago

Yes, the injector will be used in the injected component.

If i pass it in the data option so i can't use : myService = inject(MyService)

Is it possible to have a property in the options to add the injector of the parent component so that it is transparent?

this.newComponent = createComponent(componentToCreate, { environmentInjector: this.injector, **elementInjector : options.injector** /*is valid ?*/ });

GreenFlag31 commented 1 week ago

Hi. I have implemented the desired changes of the 2 opened tickets.

Could you:

  1. Uninstall the ngx-modal-ease in your application
  2. Put following tarball file at the root of your application: ngx-modal-ease-0.1.0.tgz
  3. npm i ngx-modal-ease-0.1.0.tgz in your project (extension should be included in the command)
  4. Test the functionnalities
  5. Provide me a feedback?

The response of a closing modal in now under the form:

interface ModalResponse {
  closedOnClickOrEscape: boolean;
  data: unknown;
}

cheers

jerome-aluffi-perso commented 6 days ago

Hi,

npm i -S ngx-modal-ease-0.1.0.tgz doesn't seem to work.

npm warn tarball tarball data for file:ngx-modal-ease-0.1.0.tgz (null) seems to be corrupted. Trying again. npm warn tarball tarball data for file:ngx-modal-ease-0.1.0.tgz (null) seems to be corrupted. Trying again. npm error code ENOENT

Le sam. 29 juin 2024 à 12:59, Manu Claeys @.***> a écrit :

Hi. I have implemented the desired changes.

Could you:

  1. Uninstall the ngx-modal-ease in your application
  2. Put the tarball file at the root of your application
  3. npm i ngx-modal-ease-0.1.0.tgz in your project (extension should be included in the command)
  4. Test the functionnalities
  5. Provide me a feedback?

The response of a closing modal in now under the form:

interface ModalResponse { closedOnClickOrEscape: boolean; data: unknown;}

cheers

— Reply to this email directly, view it on GitHub https://github.com/GreenFlag31/modal-library/issues/6#issuecomment-2198105563, or unsubscribe https://github.com/notifications/unsubscribe-auth/A33VQGNIJB5ME3JEAFWXTCLZJ2HRLAVCNFSM6AAAAABJ3P5XS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJYGEYDKNJWGM . You are receiving this because you authored the thread.Message ID: @.***>

GreenFlag31 commented 6 days ago

Hi

This problem usually occurs because the current ngx-modal-ease has not been uninstalled or uncorrectly uninstalled.

Could you make sure that:

Cheers

GreenFlag31 commented 4 days ago

Everything works on my side doing the recommanded steps. Did you achieve to test it?

jerome-aluffi-perso commented 4 days ago

Hi,

Le mar. 2 juil. 2024 à 18:55, Manu Claeys @.***> a écrit :

Everything works on my side doing the recommanded steps. Did you achieve to test it?

— Reply to this email directly, view it on GitHub https://github.com/GreenFlag31/modal-library/issues/6#issuecomment-2203839630, or unsubscribe https://github.com/notifications/unsubscribe-auth/A33VQGLB2C6XZGCAMPC5B5DZKLLQNAVCNFSM6AAAAABJ3P5XS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBTHAZTSNRTGA . You are receiving this because you authored the thread.Message ID: @.***>

GreenFlag31 commented 3 days ago

Yep, just npm i ngx-modal-ease-0.1.0.tgz.

Tell me if it still doesn't work, I will publish a new version.

jerome-aluffi-perso commented 3 days ago

Hi, It still doesn't work. Sorry.

Le mer. 3 juil. 2024 à 18:24, Manu Claeys @.***> a écrit :

Yep, just npm i ngx-modal-ease-0.1.0.tgz.

Tell me if it still doesn't work, I will publish a new version.

— Reply to this email directly, view it on GitHub https://github.com/GreenFlag31/modal-library/issues/6#issuecomment-2206745349, or unsubscribe https://github.com/notifications/unsubscribe-auth/A33VQGKYXLIMC23BLXAORI3ZKQQU3AVCNFSM6AAAAABJ3P5XS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBWG42DKMZUHE . You are receiving this because you authored the thread.Message ID: @.***>