HttpClientJsonpModule

为支持 JSONP 的 HttpClient 配置依赖注入器。 如果没有该模块,Jsonp 请求就会被发送到后端,然后被后端拒绝。

Configures the dependency injector for HttpClient with supporting services for JSONP. Without this module, Jsonp requests reach the backend with method JSONP, where they are rejected.

查看"说明"...

      
      class HttpClientJsonpModule {
}
    

说明

通过把拦截器提供为内置的 DI 令牌 HTTP_INTERCEPTORS(允许有多个),你可以把它们添加到 HttpClient 调用链的后面。

You can add interceptors to the chain behind HttpClient by binding them to the multiprovider for built-in DI token HTTP_INTERCEPTORS.

提供商

提供商
      
      JsonpClientBackend
    
{ provide: JsonpCallbackContext, useFactory: jsonpCallbackContext }
      
      { provide: JsonpCallbackContext, useFactory: jsonpCallbackContext }
    
{ provide: HTTP_INTERCEPTORS, useClass: JsonpInterceptor, multi: true }
      
      { provide: HTTP_INTERCEPTORS, useClass: JsonpInterceptor, multi: true }