角度 5 错误 端点无法访问



升级我的一个项目依赖项(ngx-config(后收到此错误。这是来自控制台的完整错误。

Unhandled Promise rejection: Endpoint unreachable! ; Zone: <root> ; Task: Promise.then ; Value: Endpoint unreachable! undefined (zone.js:630)

注意:ng serve工作和编译都很好,但此错误发生在运行时。

这个错误是由ngx-config引发的。

事实证明,我们正在使用HTTP_INTERCEPTORS这取决于HttpClient。最新版本的 ngx-config 也使用 HttpClient(而不是旧的Http(。在将ngx-config/core和ngx-config/http-loader升级到版本5.0.0时,出现了循环依赖。获取config.json的调用现在正在通过拦截器,但拦截器取决于config.json中的配置设置。我只是将以下内容添加到拦截器中:

if (req.url.endsWith(".json")) {
  return next.handle(req).do((event: HttpEvent<any>) => { return })
}

我希望有一种方法可以将例外全局添加到拦截器(黑名单、白名单或两者兼而有之(,但似乎没有任何计划 https://github.com/angular/angular/issues/20203 实现这样的功能。

尝试在

app.module.ts 中包含以下内容:

{ provide: LocationStrategy, useClass: HashLocationStrategy }

这对我来说是工作

最新更新