Angular 5 – redirect page to homepage on browser refresh

As mentioned by Chris Sharp, your app is doing exactly what it should do, routing to the place that the url is pointing to, since you have not told it otherwise.

What you can do, is that in your app.component you can in OnInit redirect to root. This then means that when app is (re)initialized, you are being redirected to root page.

export class AppComponent { 
  constructor(private router: Router) {}

  ngOnInit() {

Import Router

import { Router } from '@angular/router';

Initiate Router in Constructor

export class LoginComponent implements OnInit {
 constructor(private router:Router) {}
  loginCheck() {
    this.router.navigate(['/*Your Path Here*/'])