Skip to content

NullInjectorError for ModalDialogParams when opening a modal with ActionBar #82

Closed
@alexander-mai

Description

@alexander-mai

Environment

  • CLI: 8.3.3
  • Android Runtime: 8.3.1
  • iOS Runtime: 8.3.3
  • NativeScript-Angular: 14.0.4
  • Angular: 14.1.3

Describe the bug
Using modal dialogs is not described in the current documentation for Nativescript 8.x, but in the oder documentation for Nativescript 7.x here: https://v7.docs.nativescript.org/angular/ui/ng-components/modal-view-ng#modal-view-actionbar. When opening a modal with an actionbar the page gets blank and a NullInjectorError for ModalDialogParams is shown in the log:

  ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(HomeModule)[ModalDialogParams -> ModalDialogParams -> ModalDialogParams -> ModalDialogParams]:
  NullInjectorError: No provider for ModalDialogParams!
  NullInjectorError: R3InjectorError(HomeModule)[ModalDialogParams -> ModalDialogParams -> ModalDialogParams -> ModalDialogParams]:
  NullInjectorError: No provider for ModalDialogParams!
  at NullInjector.get (file: src/webpack:/modal-example/node_modules/@angular/core/fesm2015/core.mjs:6349:0)
  at R3Injector.get (file: src/webpack:/modal-example/node_modules/@angular/core/fesm2015/core.mjs:6776:0)
  at R3Injector.get (file: src/webpack:/modal-example/node_modules/@angular/core/fesm2015/core.mjs:6776:0)
  at R3Injector.get (file: src/webpack:/modal-example/node_modules/@angular/core/fesm2015/core.mjs:6776:0)
  at R3Injector.get (file: src/webpack:/modal-example/node_modules/@angular/core/fesm2015/core.mjs:6776:0)
  at ChainedInjector.get (file: src/webpack:/modal-example/node_modules/@angular/core/fesm2015/core.mjs:13855:0)
  at lookupTokenUsingModuleInjector (file: src/webpack:/modal-example/node_modules/@angular/core/fesm2015/core.mjs:3279:0)
  at getOrCreateInjectable (file: src/webpack:/modal-example/node_modules/@angular/core/fesm2015/core.mjs:3324:0)
  at Module.ɵɵdirectiveInject (file: src/webpack:/modal-example/node_modules/@angular/core/fesm2015/core.mjs:10868:0)
  at NodeInjectorFactory.ModalViewActionBarC<…>

This happens on android and on ios.
The latest version of Angular 13 and @nativescript/angular 13 is working fine.

To Reproduce

  • checkout the repository
  • run the app with ns debug ios or ns debug android

Expected behavior

  • when clicking on the button SHOW MODAL should show the modal dialog with an action bar

Sample project
https://github.com/alexander-mai/nativescript-angular14-actionbar-modal-error-example

Additional context
package-angular13.json contains a working version of the package.json with angular 13 for the project

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