2016-08-21 6 views
0

라는 메시지가 표시됩니다 웹을 www.myweb.com/something로 이동 : 여기라우팅 기본 작동하지 않는 404

{ 
    "status": 404, 
    "message": "No Content" 
} 

내 app.routes입니다 :

export const routes: RouterConfig = [ 
    { path: '', redirectTo: 'account', pathMatch: 'full' }, 
    { path: 'account', component: Account }, 
    { path: 'followers', component: Followers }, 
    { path: 'explore/:id', component: Explore }, 
    { path: '**', redirectTo: 'account' }, 
    ]; 

임은 각 사용 보편적으로, 나는이 코드를 server.ts라고 부르는 또 다른 파일을 가지고있다 :

// Routes with html5pushstate 
// ensure routes match client-side-app 
app.get('/', ngApp); 
app.get('/followers', ngApp); 
app.get('/followers/*', ngApp); 
app.get('/account', ngApp); 
app.get('/account/*', ngApp); 
app.get('/explore', ngApp); 
app.get('/explore/*', ngApp); 

어디에서 문제가 발생 했습니까? 감사! 경로가 일치하지 않는 경우 아래 시도 할 수

답변

1

// notice the slash in front of account navigation 
{ path: '**', redirectTo: '/account' } 

그것은 탐색 절대 수 있습니다.

희망이 도움이됩니다!

+0

리소스를로드하지 못했습니다. 서버가 404 상태로 응답했습니다 (찾을 수 없음) :( –

+0

www.myweb.com/account에서 라우팅이 작동합니까? –

+0

예, 정상적으로 작동합니다. –

관련 문제