角2:如何使用/导入HTTP模块? [英] Angular 2: How to use/import the http module?

查看:413
本文介绍了角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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆