IONIC 4 - Can't resolve all parameters for NavParams

When i add the line (private navParams: NavParams,) to constructor() of any new page i receive this error: Can’t resolve all parameters for NavParams

I’m running Ionic 4.5.0
I tried a new clean project. Same error.

I tried to import NavParams at app.module.ts or at my page.module.ts but others erros occurs.

This error happens even if no use of NavParams is done.
Only type “private navParams: NavParams” to the page construct() is enough to the error appears.

Thanks

Which version of Ionic? You listed the CLI version number in your post.

Sorry.
@ionic/angular 4.0.0-beta.17

ionic (Ionic CLI) : 4.5.0
Ionic Framework : @ionic/angular 4.0.0-beta.17
@angular-devkit/build-angular : 0.10.7
@angular-devkit/schematics : 7.0.7
@angular/cli : 7.0.7
@ionic/angular-toolkit : 1.2.0

Ionic’s lazy loading is so fragile. I recommend completely ignoring it and removing all submodules in favor of putting everything in a monolithic app module. Your problem is likely caused by IonicModule not being imported where needed.

How can I import Ionic module please explain it clearly …!!!

Hey @Lachu, I created a github repo with an example Ionic 4 app where you can see how to import Ionic modules and more.
Hope it helps!

Group page.html

My Groups

{{ item.groupName }}

Groups.page.ts
import { Component, OnInit } from ‘@angular/core’;
import { NavController, Events, LoadingController } from ‘@ionic/angular’;
import { GroupsService } from ‘…/services/groups.service’;
import { Router, ActivatedRoute } from ‘@angular/router’;
@Component({
selector: ‘app-groups’,
templateUrl: ‘./groups.page.html’,
styleUrls: [’./groups.page.scss’],
})
export class GroupsPage implements OnInit {
allmygroups:any;

constructor(private route:Router,private router:ActivatedRoute,private grpService:GroupsService,private loadingCtrl:LoadingController,private navCtrl:NavController,private events:Events) { }

ngOnInit() {
}

openchat(group) {
this.grpService.getintogroup(group.groupName);
//this.navCtrl.navigateRoot(‘groupchat’,group.groupName);
let groupName = group.groupName;
this.route.navigate([‘groupchat’,groupName]);
}
}

groupchat.page.ts
import { Component, OnInit, Inject, ViewChild } from ‘@angular/core’;
import { ActionSheetController, NavController } from ‘@ionic/angular’;
import { GroupsService } from ‘…/services/groups.service’;
import { Router, ActivatedRoute, } from ‘@angular/router’;

@Component({
selector: ‘app-groupchat’,
templateUrl: ‘./groupchat.page.html’,
styleUrls: [’./groupchat.page.scss’],
})
export class GroupchatPage implements OnInit {
owner: boolean = false;
groupName:any = ;

constructor(private route:Router,private router:ActivatedRoute,private navCtrl:NavController,private actionSheet:ActionSheetController,private grpService:GroupsService) {
//this.groupName = this.navParams.get(‘groupName’);
this.groupName = this.router.snapshot.paramMap.get(‘groupName’);
this.grpService.getownership(this.groupName).then((res) => {
if(res)
this.owner = true;
}).catch((err) => {
alert(err);
})
}

app.routing,module.ts
import { NgModule } from ‘@angular/core’;
import { PreloadAllModules, RouterModule, Routes,Router } from ‘@angular/router’;

const routes: Routes = [
{ path: ‘’, redirectTo: ‘login’, pathMatch: ‘full’ },
{ path: ‘login’, loadChildren: ‘./login/login.module#LoginPageModule’ },
{ path: ‘tabs’, loadChildren: ‘./tabs/tabs.module#TabsPageModule’ },
{ path: ‘chats’, loadChildren: ‘./chats/chats.module#ChatsPageModule’ },
{ path: ‘groups’, loadChildren: ‘./groups/groups.module#GroupsPageModule’ },
{ path: ‘profile’, loadChildren: ‘./profile/profile.module#ProfilePageModule’ },
{ path: ‘buddies’, loadChildren: ‘./buddies/buddies.module#BuddiesPageModule’ },
{ path: ‘buddychat’, loadChildren: ‘./buddychat/buddychat.module#BuddychatPageModule’ },
{ path: ‘passwordreset’, loadChildren: ‘./passwordreset/passwordreset.module#PasswordresetPageModule’ },
{ path: ‘profilepic’, loadChildren: ‘./profilepic/profilepic.module#ProfilepicPageModule’ },
{ path: ‘signup’, loadChildren: ‘./signup/signup.module#SignupPageModule’ },
{ path: ‘newgroup’, loadChildren: ‘./newgroup/newgroup.module#NewgroupPageModule’ },
{ path: ‘groupchat/groupName’, loadChildren: ‘./groupchat/groupchat.module#GroupchatPageModule’ },
{ path: ‘groupbuddies’, loadChildren: ‘./groupbuddies/groupbuddies.module#GroupbuddiesPageModule’ },
{ path: ‘groupmembers’, loadChildren: ‘./groupmembers/groupmembers.module#GroupmembersPageModule’ },
{ path: ‘groupinfo’, loadChildren: ‘./groupinfo/groupinfo.module#GroupinfoPageModule’ },
];

@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }

This is my code I have an error while routing to groupchat page from group page by using this code openchat(group) {
** this.grpService.getintogroup(group.groupName);**
** //this.navCtrl.navigateRoot(‘groupchat’,group.groupName);**
** let groupName = group.groupName;**
** this.route.navigate([‘groupchat’,groupName]);**
** }**

THIS IS MY ERROR PLEASE HELP ME OUT

core.js:15724 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: ‘groupchat/Mortal%20Kombat’
Error: Cannot match any routes. URL Segment: ‘groupchat/Mortal%20Kombat’
at ApplyRedirects.push…/node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError (router.js:2469)
at CatchSubscriber.selector (router.js:2450)
at CatchSubscriber.push…/node_modules/rxjs/_esm5/internal/operators/catchError.js.CatchSubscriber.error (catchError.js:34)
at MapSubscriber.push…/node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:79)
at MapSubscriber.push…/node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:59)
at MapSubscriber.push…/node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:79)
at MapSubscriber.push…/node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:59)
at MapSubscriber.push…/node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:79)
at MapSubscriber.push…/node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:59)
at ThrowIfEmptySubscriber.push…/node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:79)
at resolvePromise (zone.js:831)
at resolvePromise (zone.js:788)
at zone.js:892
at ZoneDelegate.push…/node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17290)
at ZoneDelegate.push…/node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push…/node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at drainMicroTaskQueue (zone.js:601)
at ZoneTask.push…/node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:502)
at invokeTask (zone.js:1744)

Thank you @dayanajabif for your help…!!!