Problem Statement
What’s the difference between routerLink and router.navigate()?
Explanation
routerLink is a declarative directive used in templates for anchor navigation, which also updates active link styling. router.navigate() is an imperative API used from code (e.g., after a save) to navigate programmatically with extras like query params and state.
Code Solution
SolutionRead Only
<a [routerLink]="['/orders', order.id]"></a>
// TS
this.router.navigate(['/orders', id], { queryParams: { tab: 'items' } });