【问题标题】:angular2 Routing issue with pathmatchangular2 路径匹配的路由问题
【发布时间】:2016-08-01 14:37:32
【问题描述】:

所以我决定重试 angular2 教程,因为上次我遇到了一些路由器问题(听起来很熟悉?)。见链接: Angular 2 tutorial 我遵循每一步,让一切正常工作,直到我到达重定向部分。

{
  path: '',
  redirectTo: '/dashboard',
  pathMatch: 'full'
},

它挂在“pathMatch”上的位置。即使我尝试在命令窗口中使用“npm start”重新启动,我也会收到此错误:

app/app.routes.ts(11,5): error TS2322: Type '({ path: string; redirectTo: string; pathMatch: string; } | { path: string; component: typeof Das...' is not assignable to type 'Route[]'.

我在 package.json 中定义的路由器版本是: "@angular/router": "3.0.0-alpha.7",我以为是最新版本?

如何检查我的项目/PC 上实际安装了哪个路由器版本?我对整个 npm-deal 有点陌生,我很难弄清楚这件事。我猜我可能有一个旧的路由器版本?

提前感谢您帮助我。

【问题讨论】:

标签: angular angular2-routing


【解决方案1】:

好的,我想您现在应该已经找到了答案,但是您可以通过以下方法检查您的系统上安装了哪个版本的路由器

进入 node_modules 文件夹,然后进入 @angular,然后进入路由器

node_modules/@angular/路由器
├── README.md
├── 捆绑
├── index.d.ts
├── index.js
├── index.js.map
├── index.metadata.jsenter code hereon
├── package.json ├── src

希望您的问题得到解决。 谢谢。

【讨论】:

  • 感谢您提供这个答案!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-26
  • 1970-01-01
  • 2011-10-25
  • 2016-11-29
  • 2011-06-16
  • 1970-01-01
相关资源
最近更新 更多