일반적으로 <a routerLink="/detail/{{record.TA001}}">
과 같은 세부 링크에 대한 홈 링크의 링크를 클릭하면 제대로 작동하고 CSS 파일이 잘 처리됩니다.param reload 페이지 변경이있는 Angular2 라우터는 CSS 파일 디렉토리를 얻습니다.
localhost:3000/detail/0006
과 같이이 세부 정보 페이지가 새로 고쳐지지만 CSS 파일은 CSS 파일을 가져올 수 없으므로 CSS 파일은 디렉토리를 루트 디렉토리로 변경합니다. 내 세부 구성 요소는 app/content
디렉토리에 있습니다. 프로젝트의 루트 디렉토리에
내 index.html
및 CSS 파일. 라우터 :
const appRoutes: Routes = [
{
path: 'contact',
component: Contactcomponent
},
{
path: 'detail/:id',
component: Detailcomponent
},
{ path: '',
component: Contentcomponent
}
내 프로젝트 디렉토리는 다음과 같이이다 :
내가이 문제를 해결하는 방법을 알고
http://stackoverflow.com/questions/31415052/angular-2-0-router-not-working-on-reloading-the -browser/36310728 # 36310728 –