router['location']['_baseHref'] code example
Example 1: angular router navigate base href
providers: [
{
provide: APP_BASE_HREF,
useValue: '/' + (window.location.pathname.split('/')[1] || '')
}
]
Example 2: angular router navigate base href
import { APP_BASE_HREF } from '@angular/common';