Based on some good information here and here, you may need to re-evaluate your use of RouterModule.forChild
in your core routing file, app-routing.module.ts.
Perhaps you can try editing your app-routing.modules.ts file to contain the following:
import { ExtraOptions, RouterModule, Routes } from '@angular/router';
const routerOptions: ExtraOptions = {
scrollPositionRestoration: 'enabled',
anchorScrolling: 'enabled',
scrollOffset: [0, 64],
onSameUrlNavigation: 'ignore',
};
@NgModule({
imports: [RouterModule.forRoot(routes, routerOptions)],
exports: [RouterModule]
})
You can toggle onSameUrlNavigation
to have the value 'ignore' or 'reload'. If you change it to 'ignore', does it change the behavior when you click on the fragment link? The above has worked for me.
As the linked articles show, you can rather implement RouterModule.forChild
in a separate routing file if it contains specific routes you want to use in relation to your base/root.