title: angular: how to make link to jump for certain section in the same page
body: <p>I want to an anchor link to jump to specific section in the same page using id hashtag. here is my html:</p>
  
  <pre><code>&lt;div class="nav-container"&gt;
    &lt;ul class="nav text-center"&gt;
      &lt;li class="active"&gt;
        &lt;a href="#account-services"&gt;Services&lt;/a&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;a [routerLink]="['//account/'+account.account_id]" fragment="account-about"&gt;About&lt;/a&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;a href="#account-gallery"&gt;Gallery&lt;/a&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;a href="#account-reviews"&gt;Reviews&lt;/a&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div class="account-details"&gt;
    &lt;div id="account-services"&gt;
      &lt;h1&gt;services&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div id="account-about"&gt;
      &lt;h1&gt;About Us&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div id="account-store"&gt;
      &lt;h1&gt;Store&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div id="account-gallery"&gt;
      &lt;h1&gt;Gallery&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div id="account-reviews"&gt;
      &lt;h1&gt;Reviews&lt;/h1&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>ts component:</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { ActivatedRoute } from '@angular/router';
  
  @Component({
    selector: 'app-account-individual',
    templateUrl: './account-individual.component.html',
    styleUrls: ['./account-individual.component.css']
  })
  export class AccountIndividualComponent implements OnInit {
  
    private fragment: string;
  
    constructor(private route: ActivatedRoute) {}
  
    ngOnInit() {
      this.route.fragment.subscribe(fragment =&gt; { this.fragment = fragment; });
    }
  
    ngAfterViewInit(): void {
      try {
        document.querySelector('#' + this.fragment).scrollIntoView();
      } catch (e) {
        console.log(e);
      }
    }
  }
  </code></pre>