小编Iho*_*kha的帖子

如何在导出的函数中禁用拦截器?

我使用 ngx-translator 进行本地化。当我尝试读取本地化存储在本地文件夹中的 json 文件时,我收到错误 HttpErrorResponse {headers: HttpHeaders, status: 404, statusText: "Not Found", url: "http:/host.com/api/资产/i18n/en.json”,好的:假,...}。我认为问题出在我在应用程序中使用的拦截器中。

// app.module.ts
export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
}
Run Code Online (Sandbox Code Playgroud)

如何在此功能中禁用拦截器?我试图将标头设置为 X-Skip-Interceptor,但它没有帮助。

localization interceptor angular-http-interceptors ngx-translate angular

3
推荐指数
1
解决办法
949
查看次数