Ionic added new page but showing No provider for NavParams

Viewed 609

I have just create a page in my application manually it have 3 files .html .scss .ts

My app.routing.module.ts

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { OrderSummaryPage } from './checkout/order-summary/order-summary.page';
import { WelcomePage } from '../app/welcome/welcome.page';

const routes: Routes = [
  { path: '', redirectTo: 'welcome', pathMatch: 'full' },
    { path: 'welcome', component: WelcomePage },

  { path: 'order-summary/:id', component: OrderSummaryPage },

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

And the welcome.page.ts need to show this page as first page of app

import { Component, OnInit } from '@angular/core';
import { ApiService } from '../api.service';
import { LoadingController, ModalController } from '@ionic/angular';
import { NavParams } from '@ionic/angular';
import { Settings } from '../data/settings';

@Component({
    selector: 'app-welcome',
    templateUrl: './welcome.page.html',
    styleUrls: ['./welcome.page.scss'],
})
export class WelcomePage implements OnInit {

    constructor(public api: ApiService, public loadingController: LoadingController, public modalCtrl: ModalController, public settings: Settings, public navParams: NavParams) {}
    ngOnInit() {}

}

But when I run the app it's showing this error

StaticInjectorError(Platform: core)[WelcomePage -> NavParams]: 
    NullInjectorError: No provider for NavParams!

How can i simply show this welcome page when app starts? I already add WelcomePage in app.module.ts and add it in declaration and entry components.

0 Answers
Related