title: How to set base path for static files in Angular 7?
body: <p>I have tried three approaches.</p>
  
  <p><strong>1st : index.html</strong></p>
  
  <pre><code>&lt;base href="/customer"&gt;
  </code></pre>
  
  <p><strong>2nd : app.module.ts</strong></p>
  
  <pre><code>@NgModule({
    providers: [{provide: APP_BASE_HREF, useValue: '/customer'}]
  })
  </code></pre>
  
  <p><strong>3rd : app-routing.module.ts</strong></p>
  
  <pre><code>const routes: Routes = [
    { path: "", redirectTo: "/customer", pathMatch: "full" },
    {
      path: "customer",
      component: CustomerComponent,
      data: { animation: "HomePage" }
    }
  ];
  </code></pre>
  
  <p>All the above approaches work well for URL routing and I get desired URL.</p>
  
  <p><a href="http://localhost:4200/customer" rel="nofollow noreferrer">http://localhost:4200/customer</a></p>
  
  <p>However, static files(js &amp; images) are still loading with the base path '<a href="http://localhost:4200/" rel="nofollow noreferrer">http://localhost:4200/</a>'. I need it to have like <a href="http://localhost:4200/customer/main.js" rel="nofollow noreferrer">http://localhost:4200/customer/main.js</a>.</p>
  
  <p>Hence, I am trying to make it <a href="http://localhost:4200/customer/main.js" rel="nofollow noreferrer">http://localhost:4200/customer/main.js</a> instead of <a href="http://localhost:4200/main.js" rel="nofollow noreferrer">http://localhost:4200/main.js</a> for some secure validation reason.</p>
  
  <p>Same can be seen in below screenshot.</p>
  
  <p><a href="https://i.stack.imgur.com/umrJH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/umrJH.png" alt="enter image description here"></a></p>