Angular 5 commands.reduce不是router.navigate中的函数

Rob*_*lls 7 angular

我发送一个字符串作为我的路由器的链接,例如"/ blog/pages/3"

但是我收到错误"commands.reduce不是函数"

导航确实有效,只是错误显示在控制台中

goToPage(link) {
  this.router.navigate(link);
}
Run Code Online (Sandbox Code Playgroud)

小智 13

该函数应该像这样写.在参数中使用方括号:

goToPage(link) {
  this.router.navigate([link]);
}
Run Code Online (Sandbox Code Playgroud)