how to make a link go to certain part of page code example

Example 1: javascript redirect

window.location.href = "http://mywebsite.com/home.html";

Example 2: how do you make a link to the top of a page

<a href="#top">Back to top of page</a>

Example 3: how to add changes every time you route navigate to page in angular

// Place import at the top
import { Router,NavigationStart} from '@angular/router';

//Place the code below inside your class
constructor(private router: Router){}

ngOnInit(){
   this.router.events.subscribe(event =>{
      if (event instanceof NavigationStart){
   		
      }
   })
}