title: Springboot/Angular2 - How to handle HTML5 urls?
body: <p>I believe this is a simple question, but I couldn't find an answer or at least use the correct terms in the search.</p>
  
  <p>I am setting up <code>Angular2</code> and <code>Springboot</code> together. By default, <code>Angular</code> will use paths like <code>localhost:8080\dashboard</code> and <code>localhost:8080\dashboard\detail</code>.</p>
  
  <p>I'd like to avoid using path as hashs, if possible. As Angular <a href="https://angular.io/docs/ts/latest/guide/router.html#!#browser-url-styles" rel="noreferrer">documentation</a> states:</p>
  
  <blockquote>
    <p>The router's provideRouter function sets the LocationStrategy to the PathLocationStrategy, making it the default strategy. We can switch to the HashLocationStrategy with an override during the bootstrapping process if we prefer it.</p>
  </blockquote>
  
  <p>And then...</p>
  
  <blockquote>
    <p>Almost all Angular 2 projects should use the default HTML 5 style. It produces URLs that are easier for users to understand. And it preserves the option to do server-side rendering later.</p>
  </blockquote>
  
  <p>The issue is that when I try to access <code>localhost:8080\dashboard</code>, Spring will look for some controller mapping to this path, which it won't have.</p>
  
  <pre><code>Whitelabel Error Page
  There was an unexpected error (type=Not Found, status=404).
  No message available
  </code></pre>
  
  <p>I thought initially to make all my services to be under <code>localhost:8080\api</code> and all my static under <code>localhost:8080\app</code>. But how do I tell Spring to ignore requests to this <code>app</code> path?</p>
  
  <p>Is there a better solution with either Angular2 or Boot?</p>