Thank you @AtiqurDhaka! This is good stuff. Proving that NavParams does indeed still exist, however there are now more streamlined ways of accomplishing this
Suddently the NavParams does not work anymore and throws the error: No Provider blah blah. Is this a pseudo error? Normally you can simply use the NavParams. Maybe there is a module not imported in the app.module.ts or modules of the component?
Now a bug appears where somebody has forgotten to properly pass the importantThing, and somebody else suggests making this snippet more defensive:
constructor(np: NavparamService) {
if ("wantedKey" in np.param) {
this.importantThing = np.param.wantedKey;
} else {
throw new Error("important thing is missing!");
}
}
…and we instantly get the worst of all possible worlds: every single instantiation of this page fails in production (although it will work with the (sane) mocked-out NavparamService in testing), yet no error is thrown. How could this possibly be?
I had the same Problem and Solved it! In my case i added a service to my component and due to copy paste I added NavParams to the Service and don’t used it. So in my case the unused variables caused the problem. Solution delete them