我想从http://www.domain.tld/apppath/提供服务

这样所有路线都将如下所示:


domain.tld / apppath / homepage
domain.tld / apppath / searchpage
domain.tld / apppath / resultspage


等等....

如何配置路由器,这样我就不必为每个路由明确指定“ apppath”前缀?

最佳答案

<head>
  <base href="/apppath">


要么

@NgModule({
  providers: [{provide: APP_BASE_HREF, useValue: '/apppath'}],
  ...
})
export class AppModule{}

09-26 04:32