我的Angular2应用程序部署在IIS上网站的子目录中。我使用下面的命令来构建它。 (--bh设置子目录作为根的应用):当路由到应用程序的子目录时,URL在Angular2中增长
ng build --bh testdna --no-aot --dev
我然后在应用程序中使用的路由与如下
app.routes.ts:
import { Routes } from '@angular/router';
import { DnaPlotComponent } from './dna-plot/dna-plot.component';
export const routes: Routes = [{ path: '', component: DnaPlotComponent }];
app.module.ts:
import { RouterModule } from '@angular/router';
import { routes } from './app.routes';
...
RouterModule.forRoot(routes)
每次页面刷新的URL有时间附加到它的子目录。这意味着URL会无限增长,无法刷新,导致404错误。下面是我看到的一个例子。
https://develop.domain.com/dnaplot/dnaplot#/dnaplot/
原始URL称为是:
https://develop.domain.com/dnaplot
任何想法,以制止这种情况的发生,将不胜感激。