I'm setting up an ionic application with multiple pages.
I use RouterModule from @angular/router for navigation.
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { DetailComponent } from './detail/detail.component';
const routes: Routes = [
{
path: "home",
loadChildren: () =>
import("./home/home.module").then((m) => m.HomePageModule),
},
{
path: "",
redirectTo: "home",
pathMatch: "full",
},
{
path: "detail", component: DetailComponent
}
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
On the main page i got this :
<ion-col size="2" class="ion-align-self-end">
<button type="submit" class="btn btn-primary" [routerLink]="['/detail']">Go</button>
</ion-col>
When i click on the button I navigate to the detailPage and there is my detail component :
<ion-header translucent>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button ></ion-back-button>
</ion-buttons>
<ion-title>Page Two</ion-title>
</ion-toolbar>
</ion-header>
<ion-content fullscreen class="ion-padding">
<p>Back-Button is displayed when there is history</p>
</ion-content>
The back button arrow is displayed but when I click on it nothing happens On the inspector i got the ion-router-outlet and it seems ok
<ion-router-outlet>
<app-home>
<app-detail>
</ion-router-outlet>
I also tried to use this :
<ion-back-button defaultHref="/"></ion-back-button>
Not better :(