@kawthar1 wrote:
Hello,
I am trying to navigate between pages using Router but i can’t get it to work can any one help me here :
import { Router } from "@angular/router"; . . . constructor(public router: Router) { } createChildProfile() { this.router.navigateByUrl('/updateChildProfileImage'); }
I am using ionic 4 so yes i did configure routesin app-routing.module.ts:
const routes: Routes = [ { path: '', redirectTo: 'welcome', pathMatch: 'full' }, { path: 'welcome', loadChildren: './pages/welcome-page/welcome-page.module#WelcomePageModule' }, { path: 'updateChildProfileImage', component: UpdateChildProfileImage } ];
Until now i didn’t add anything special in html just the default content:
<ion-content> <div class="ion-padding"> The world is your oyster. <p>If you get lost, the <a target="_blank" rel="noopener" href="https://ionicframework.com/docs/">docs</a> will be your guide.</p> </div> </ion-content>
now when i navigate to this page (the route: updateChildProfileImage) i got a blank page and an error message:
vendor.js:81041 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[Content -> Config]: StaticInjectorError(Platform: core)[Content -> Config]: NullInjectorError: No provider for Config! Error: StaticInjectorError(AppModule)[Content -> Config]: StaticInjectorError(Platform: core)[Content -> Config]: NullInjectorError: No provider for Config! at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (vendor.js:74213) at resolveToken (vendor.js:74458) at tryResolveToken (vendor.js:74402) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (vendor.js:74299) at resolveToken (vendor.js:74458) at tryResolveToken (vendor.js:74402) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (vendor.js:74299) at resolveNgModuleDep (vendor.js:86535) at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (vendor.js:87224) at resolveDep (vendor.js:87595) at resolvePromise (polyfills.js:3189) at resolvePromise (polyfills.js:3146) at polyfills.js:3250 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2781) at Object.onInvokeTask (vendor.js:82607) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2780) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (polyfills.js:2553) at drainMicroTaskQueue (polyfills.js:2959) at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (polyfills.js:2860) at ZoneTask.invoke (polyfills.js:2845)
Posts: 1
Participants: 1