How to use routerLink in ionic v7

I tried to use routerLink in my code with ionic 7 angular and I got the following error: error NG8002: Can’t bind to ‘routerLink’ since it isn’t a known property of ‘ion-button’.

In the .ts file

import { RouterLinkWithHref } from '@angular/router';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
  standalone: true,
  imports: [IonicModule, RouterLinkWithHref ]
  
})

In .html

<ion-button [routerLink]="['/about']">About us</ion-button>

Ionic 7 updates ///Ionic 7 Inline Alert custom styles - YouTube

2 Likes

Thank you so much, it works now