title: How can I navigate to an anchor in Angular 7
body: <p>I've enable the anchorScrolling in routingModule and all the path but when i click on links nothing happened.</p>
  
  <p>'nav-bar.component.html' <br></p>
  
  <pre><code>&lt;div id="mySidenav" class="sidenav" #sidenav&gt;
     &lt;a href="javascript:void(0)" class="closeBtn" 
     (click)="closeNav()"&gt;&amp;times;&lt;/a&gt;
     &lt;a routerLink="/hazyMinds" [fragment]="'HazyMinds'"&gt;HazyMinds&lt;/a&gt;
     &lt;a routerLink="/ourGames" [fragment]="'Games'"&gt;Our Games&lt;/a&gt;
     &lt;a routerLink="/contact" [fragment]="'Contact'"&gt;Contact&lt;/a&gt;
  &lt;/div&gt;
  &lt;span id="openNavBtn"  (click)="openNav()" #openBtn&gt;&amp;#9776;&lt;/span&gt;
  </code></pre>
  
  <p><br><br> 'app.component.html' <br></p>
  
  <pre><code>&lt;app-nav-bar&gt;&lt;/app-nav-bar&gt;
  &lt;app-hazy-minds id="HazyMinds"&gt;&lt;/app-hazy-minds&gt;
  &lt;app-games id="Games" &gt;&lt;/app-games&gt;
  &lt;app-contact id="Contact"&gt;&lt;/app-contact&gt;
  &lt;router-outlet&gt;&lt;/router-outlet&gt;
  </code></pre>
  
  <p><br><br> 'app-routing.module.ts' <br></p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { CommonModule } from '@angular/common';
  import { RouterModule, Routes } from '@angular/router';
  
  import {ContactComponent} from './contact/contact.component';
  import {GamesComponent} from './games/games.component';
  import {HazyMindsComponent} from './hazy-minds/hazy-minds.component';
  
  const routes: Routes = [
    {path: '', redirectTo: '/', pathMatch: 'full'},
    {path: 'hazyMinds', component : HazyMindsComponent},
    {path: 'ourGames', component : GamesComponent},
    {path: 'contact', component : ContactComponent}
  ];
  
  @NgModule({
    imports: [
      RouterModule.forRoot(routes, {
        scrollPositionRestoration: 'enabled',
        anchorScrolling: 'enabled',
        scrollOffset: [0, 64]
      }),
      CommonModule
    ],
    exports: [
      RouterModule
    ]
  })
  
  
  export class AppRoutingModule { }
  </code></pre>
  
  <p>I expect that when i clicked on link it automatically scroll to the correct anchor.<br>
  Someone know what's wrong with my code? thanks</p>