navigate in ionic 5 code example

Example 1: router navigate ionic

<ion-header>
  <ion-toolbar>
    <ion-title>Login</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content class="ion-padding">
  <ion-button [routerLink]="['/detail']">Go to detail</ion-button>
</ion-content>

Example 2: ionic angular change page route

this.router.navigateByUrl('/home');

Example 3: ionic route navigation

// just like angular
<button [routerLink]="['/detail']">click</button>

Example 4: router navigate ionic

RouterModule.forRoot([
  { path: '', component: LoginComponent },
  { path: 'detail', component: DetailComponent }
]);

Tags:

Misc Example