Scroll to div in Angular

Below is the code to scroll to a specific div with Angular. It contains both the html and the typescript code to do the same.

HTML:

<button (click)="ClickMeToScroll()">Click me to scroll</button>
....
....
....
....
....

<div id="TargetDiv" class="row g-0">
  <div class="col-12 col-md-4">
    <h4>Target Div</h4>
  </div>
  <div class="col-12 col-md-8"></div>
</div>

CodeBehind (.ts):

import { ViewportScroller } from '@angular/common';
....

constructor(
......
    private scroller: ViewportScroller
  ) {
......
  }
  
clickMeToScroll() {
  this.scroller.scrollToAnchor('TargetDiv');
}