角2:如何使用/导入HTTP模块? [英] Angular 2: How to use/import the http module?
本文介绍了角2:如何使用/导入HTTP模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在玩角2快速入门。我如何使用/导入HTTP模块角2?结果
我看着角2藤的.js文件的,但它不使用HTTP模块
I've been playing with Angular 2 Quickstart. How can I use/import http module in Angular 2?
I've looked at Angular 2 Todo's .js, but it doesn't use the http module.
我已经添加了ngHttp:角/ HTTP,
到中的package.json因为依赖
我听说角2是有点模块化
I've added "ngHttp": "angular/http",
to dependencies
in package.json because I've heard Angular 2 is somewhat modular
推荐答案
在37版本中,你需要这样做:
In version 37 you need to do this:
///<reference path="typings/angular2/http.d.ts"/>
import {Http} from "angular2/http";
和运行此命令TSD:
tsd install angular2/http
这篇关于角2:如何使用/导入HTTP模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文