טיפ קטן, פשוט ושימושי! לא נפוץ במיוחד אבל תתפלאו לגלות כמה זה יכול להקל עליכם אם אתם משתמשים בruoter-outlet פנימי , ואינכם רוצים שה -URL השתנה. כל שעליכם לעשות זה:
import { Component } from '@angular/core'; import { Router } from '@angular/router' @Component({ selector: 'my-app', templateUrl: './app.component.html', styleUrls: [ './app.component.css' ] }) export class AppComponent { constructor(private router: Router) {} clickSkipChangeBtn() { this.router.navigate(["codcode"], {skipLocationChange: true}) }
או בשימוש בHTML מהצורה הזו :
<a routerLink="/codcode" skipLocationChange>codcodile</a>
זה כל הסיפור. 🐊😀