0

www.myweb.com/something にアクセスすると、Web に次のメッセージが表示されます。

{
  "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' },
  ];

私はAngular Universalを使用しているので、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);

問題はどこだ?ありがとう!

4

1 に答える 1

1

以下で試すことができます。

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

パスが一致しない場合、ナビゲーションは絶対になります。

于 2016-08-21T16:47:15.737 に答える