Angular 2子路线不起作用

时间:2017-12-18 20:24:48

标签: angular angular2-routing

我有一个子路线历史记录,我得到一个空错误。

  

未捕获(承诺):EmptyError:序列中没有元素   EmptyError:序列中没有元素

enter image description here

这是我的代码:

{path: 'calories', pathMatch: 'full', component: CaloriesComponent, canActivate: [UserService], children: [
    {path: 'history', pathMatch: 'full', component: CaloriesHistoryComponent, canActivate: [UserService]}
  ]},

2 个答案:

答案 0 :(得分:1)

当使用带角度的RxJS 5.5.3(版本4/5)时会发生此错误,因此只需跳过RxJS 5.5.3,并通过在项目中添加“rxjs”:“^ 5.5.4”来使用RxJS 5.5.4的package.json

答案 1 :(得分:-1)

我发现您的代码没有任何问题。我搜索了错误用途给了我,我发现了这篇文章。似乎与您的问题相关。我希望这会有所帮助。

Here is the post