question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: core.js:6228 ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError

See original GitHub issue

Bug Report

Ionic version:

[x] 5.2

Current behavior: Whenever entering a page with some components like

  • ion-radio-group
  • ion-range
  • ion-searchbar

I got this error:

Captura de tela de 2020-06-10 18-42-55

Expected behavior: Not have any error.

Steps to reproduce: Just update to latest ionic and angular and insert this snippet anywhere

Related code:

<ion-content >
  <ion-radio-group></ion-radio-group>
</ion-content>

Other information: After updating to new ionic and angular I started getting this error.

Captura de tela de 2020-06-10 18-52-51

Ionic info:

Ionic:

   Ionic CLI                     : 6.9.2 (/usr/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.2.0
   @angular-devkit/build-angular : 0.901.7
   @angular-devkit/schematics    : 9.1.7
   @angular/cli                  : 9.1.7
   @ionic/angular-toolkit        : 2.2.0

Capacitor:

   Capacitor CLI   : 2.2.0
   @capacitor/core : 2.2.0

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v14.2.0 (/usr/bin/node)
   npm    : 6.14.5
   OS     : Linux 5.6

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:20 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
ZhipengZengcommented, Jun 11, 2020

I have the same issue with ion-segment in the page. Turns out in ionic 5.2 it requires [(ngModel)] present.

in my case: from:

<ion-segment (ionChange)="segmentChanged($event)" value="init">
  <ion-segment-button value="init">
    <ion-label>Init</ion-label>
  </ion-segment-button>
  <ion-segment-button value="using">
    <ion-label>Using</ion-label>
  </ion-segment-button>
</ion-segment>

to:

<ion-segment (ionChange)="segmentChanged($event)" [(ngModel)]="currentValue">
  <ion-segment-button value="init">
    <ion-label>Init</ion-label>
  </ion-segment-button>
  <ion-segment-button value="using">
    <ion-label>Using</ion-label>
  </ion-segment-button>
</ion-segment>
6reactions
liamdebeasicommented, Jun 11, 2020

Thanks for the issue. This has been resolved via https://github.com/ionic-team/ionic/pull/21504, and a fix is now available as part of the Ionic Framework 5.2.1 release. Please update to v5.2.1 in order to receive this bug fix:

npm install @ionic/angular@latest

This bug was caused by https://github.com/ionic-team/ionic/commit/e95b481a53191582bca635f322ad07eadbd62d64. When attempting to get an NgControl on a component, Angular threw an error for components that were not part of a form/did not have ngModel.

The fix for this involves checking to see if the component in question is part of a form/has an ngModel to avoid this error.

Apologies for any inconvenience this may have caused. For any additional bugs, please open a new issue. Thanks for using Ionic!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught (in promise): NullInjectorError: R3InjectorError ...
ts ; when i am going to add the AccessProviders path in the project the project says: ERROR Error: Uncaught (in promise): NullInjectorError: ......
Read more >
NullInjectorError- Angular not able to find custom service
Let me introduced you to the Error, detail, and Fix. ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(HomePageModule)[ ...
Read more >
Uncaught (In Promise): Error: No Provider For Httpservice
You see this error when you try to inject a service but have not declared a corresponding provider. A provider is a mapping...
Read more >
No provider for HttpClient! angular test service Code Example
Error : Uncaught (in promise): NullInjectorError: R3InjectorError(AppModule)[HttpClient -> HttpClient -> HttpClient]: NullInjectorError: No provider for ...
Read more >
How can I reproduce this stack trace with "Uncaught ... - Reddit
Please help me report a DevTools bug related to Angular ... core.js:1449 ERROR Error: Uncaught (in promise): things broke!! at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found