0

Angular2 中实际使用的 http 绑定是什么?任何工作代码或plunker?在文档中没有记录并说使用 HTTP 提供程序。

https://angular.io/docs/ts/latest/api/http/index/HTTP_BINDINGS-let.html

https://angular.io/docs/ts/latest/api/http/index/HTTP_PROVIDERS-let.html

4

1 回答 1

1

和之间的区别HTTP_BINDINGShttps://stackoverflow.com/a/38682856/217408HTTP_PROVIDERS中解释的相同

HTTP_PROVIDERS是一组服务,您可以将其注入到您的自定义服务和组件或指令中,以进行 HTTP 调用,例如

constructor(http:Http) {
  http.get(someUrl).subscribe(...)
}
于 2016-07-31T10:10:56.087 回答