title: Angular 5: Get host name and app name from URL
body: <p>My current url is:</p>
  
  <p><a href="https://localhost:8080/MyApp/manager/dashboard" rel="noreferrer">https://localhost:8080/MyApp/manager/dashboard</a></p>
  
  <p>Within the above url I want to fetch only <a href="https://localhost:8080/MyApp/" rel="noreferrer">https://localhost:8080/MyApp/</a> part. </p>
  
  <p>Is there any way to fetch this without hard coding anything?</p>