简体   繁体   中英

the routerLink doesn't work in my angular ionic project

I am trying to create an angular ionic project, so I created a module named ident to put the login and subscribe components on it, and when I create the router to cycle between the two components it doesn't work and no errors displayed to me

ionic V 6.12.3

ident-app-routing.ts And Login HTML

 const routes: Routes = [ { path: 'Login', component: LoginComponent }, { path:'', redirectTo:'Login', pathMatch:'full' }, { path:'Signup', component:InscritComponent } ];
 <ion-buttons slot="end"> <ion-button (click)="test()" [routerLink]="['/Signup']">Signup</ion-button> </ion-buttons>

i.net.html

<ion-router-outlet></ion-router-outlet>

Please try routerLink="/Signup"

You are assigning two simultaneous actions to your button when clicked:

  • test(), which is called from.ts file when user clics the button
  • routerLink, which uses RouterModule for switching to other page

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM