Skip to content

ModalDialogParams getting NullInjectorError for components inside page-router-outlet inside modals #92

Closed
@JWiseCoder

Description

@JWiseCoder

We recently upgraded our app to Angular 14 (from Angular 13), and now all the components inside our modals are unable to get the ModalDialogParams. (When @optional(), the value is null, otherwise it throws a NullInjectorError)

We use components that contain page-router-outlets to allow for routing inside modals. The container component is receiving the ModalDialogParams fine, but the components being routed to in the page-router-outlet do not.

We tracked it down to the change to the page-router-outlet.ts in feature #72 that added support for Angular 14. Specifically, line 347 which changed the scope of the parent injector. If we change this line back to parent: this.location.injector,, we can inject the ModalDialogParams just fine.

Is this expected behavior? We've always been able to inject the ModalDialogParams this way before, but now the parent injector is different than in previous releases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions