【发布时间】:2016-06-30 17:44:49
【问题描述】:
我在 Angular2 中使用最新的路由器包(3.0.0.8?)
当我向其中一条路由添加参数时,页面无法再找到所有必需的样式和应用文件。
当我有这个时:
export const routes: RouterConfig = [
{path: '', component: LandingPageComponent },
{ path: 'buyers', component: BuyerFormComponent },
{path: 'links', component: GenerateLinksComponent},
{path: 'cc/:bid', component: SupplierFormComponent}
];
当我导航到“http://localhost:3000/cc/b4”时 我收到一堆错误:
获取http://localhost:3000/cc/styles.css
获取http://localhost:3000/cc/app等
我的其他没有参数的路由工作正常,如果我从路由中删除参数:
export const routes: RouterConfig = [
{path: '', component: LandingPageComponent },
{ path: 'buyers', component: BuyerFormComponent },
{path: 'links', component: GenerateLinksComponent},
{path: 'cc', component: SupplierFormComponent}
];
并且访问不带参数的路由(localhost3000/cc),页面加载正常。
我有 href="."在我的 index.html 中:
<html>
<head>
<base href=".">
有什么建议吗?谢谢!
【问题讨论】:
标签: parameters angular routing