http 绑定(bind)在 Angular2 中实际用于什么?有工作代码或笨蛋吗?在文档中没有记录它并说使用 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
最佳答案
HTTP_BINDINGS
和 HTTP_PROVIDERS
之间的区别与 https://stackoverflow.com/a/38682856/217408 中的解释相同。
HTTP_PROVIDERS
是一组服务,您可以将它们注入(inject)到自定义服务和组件或指令中以进行 HTTP 调用,例如
constructor(http:Http) {
http.get(someUrl).subscribe(...)
}
关于javascript - http 绑定(bind)在 Angular2 中实际用途是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38681223/