내 Angular2 앱이 IIS의 웹 사이트의 하위 디렉토리에 배포되었습니다. 다음 명령을 사용하여 빌드합니다. (--bh 앱의 루트로 하위 디렉토리를 설정) :하위 디렉토리의 앱으로 라우팅 할 때 URL이 Angular2로 증가합니다.
import { Routes } from '@angular/router';
import { DnaPlotComponent } from './dna-plot/dna-plot.component';
export const routes: Routes = [{ path: '', component: DnaPlotComponent }];
:
app.routes.ts을 다음과 같이
는ng build --bh testdna --no-aot --dev
나는 다음 응용 프로그램에서와 라우팅 사용
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
어떤 아이디어가 크게 감상 할 수있다.