No provider for NavParams! (MyApp -> NavParams)


#1

Hi everyone,

My objective is to get params from another page to the root page using NavParams with pop function.

app.ts :

@App({
    templateUrl: 'build/app.html',
    providers: [MyService]
})
export class MyApp implements OnInit {
   rootPage:any = AnotherPage;
    constructor(public app: IonicApp,public navparams : NavParams , public platform: Platform, private _MyService: MenuService) {
        this.navparams =this.navparams.get('param');
        this._MyService = _MyService;
    }
     ngOnInit() {
        
    }
}

AnotherPage :

@Page({
    templateUrl:"build/pages/Anotherpage/Anotherpage.html",
    providers: [MyService],
    directives: [IONIC_DIRECTIVES]
})
export class AnotherPage implements OnInit{
      constructor(public nav :NavController,public navparams: NavParams, private _MyService:MyService) {
        this.nav = nav;
        this._MyService = _MyService;
    }
 ngOnInit() {
 }
}

#2

I’m also looking for something similar. Were you able to get it to work?