Angular GitHub 个页面中的路由参数

Angular route params in GitHub pages

如果我的 Angular 5 应用程序托管在 GitHub 页,我可以在它中获取路由参数吗?

https://khex.github.io/myapp/1234

const routes: Routes = [
  { path: '', redirectTo: 'home', pathMatch: 'full' },
  { path: 'home/:id', component: AppComponent }
];

加载应用程序后重定向到根域 khex.github.io 并抛出错误。

当您 运行 任何 angular 应用程序时,路由器将匹配其所在的任何主机。如果您的应用托管在 github 页面上,那么根据定义,您将能够访问路由参数。