I am developping an Ionic 4 application, I have two page authentication and registration, I added my route in "app-routing.module", I set my Authentication component as a root component , so when I click on a button on the view the route changes and the registration view doesnt appear:
The App-routing.module
const routes: Routes = [
{ path: '', redirectTo: 'auth', pathMatch: 'full' },
{ path: 'auth', component: AuthenticationComponent },
{ path: 'registerFirst', component: RegistrationComponent},
];
...
This is the button inside the Authentication view
<ion-button expand="full" color="medium" [routerLink]="['/registerFirst']">CREATE AN
ACCOUNT</ion-button>
Change your routing like this:
{ path: '', redirectTo: 'registration', pathMatch: 'full' },
{
path: 'registration',
loadChildren: 'yourpath/registration.module#RegistrationPageModule'
},
...
And you must add this code to registration.module.ts
:
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{
path: '',
component: RegistrationPage
}
];
@NgModule({
imports: [
...
RouterModule.forChild(routes)
],
.....
})
And I hope it works outright