Hi guys,
I got this error when pushing params from my login.ts to /app/app.component.ts
which is like this:
this.navCtr.push(MyApp,{user: NativeStoraget.getItem("user");
and in the MyApp side in the controller I read it with:
this.user= navParams.get('user');
Actually I pass NavParams on the controllerand this error
Error in :0:0 caused by: No provider for NavParams!
has been throwing during runnig
Sorry guys for my english, it isn’t well enough.
thx for any comment
a missing closing curly bracket?
yes, here I forget the } but on the code, there’r no error
could you show us, how you inject newParams service?
import { NavController, NavParams } from 'ionic-angular';
private param1: any;
constructor(public navCtrl: NavController, public navParams: NavParams){
this.param1=navParams.get('i');
console.log(this.param1);
}
this actually work like a charm on the user.ts but not on app.component.ts
so how can’ I do this. Because I like to display the pctiure of the connected user on the sideMenu wich is on the app.html uder app/ folder
thx you
the app component has no router --> so is not part of the navigation stack.
The app-component is a component and not a page --> check your index.html there you will find the app.component selector as an element.
Use services with Observables/Subjects to inform other parts about changes.
Sorry, I’m new with ionic2. so I don’t know how to use services for this task, can you please give me an exemple or a tutorial about this