Angular2 Http
2015-07-23 21:55
148 查看
1 import http and Inject
2 init your Http and use it
3 show the result in the UI
import {httpInjectables, Http} from 'angular2/http';
import {Inject} from 'angular2/di';
2 init your Http and use it
class App { http:Http; status:int; constructor(@Inject(Http) http) { this.http = http; this.http.get('test.json').toRx().subscribe((res:Response) => { this.status = res.status; }); } }
3 show the result in the UI
{{status}}
相关文章推荐
- unix网络编程源码编译问题
- 网络攻击技术开篇——SQL Injection
- 网络攻击技术开篇——SQL Injection
- c#网络编程
- Linux C语言错误处理(转载)http://www.cnblogs.com/nliao/archive/2010/09/09/1822647.html
- http与https请求
- 深度神经网络DNN的多GPU数据并行框架 及其在语音识别的应用
- android中的加载网络图片
- http关闭连接
- TCP
- 网络图片抓取--web开发批量盗图!!!!!
- 云计算和大数据时代网络技术揭秘(十四)虚拟桌面
- HttpClient
- Win7和Winxp相互共享文件
- TCP的三次握手,四次挥手全过程
- SpringMVC template和HttpClient post提交
- 个人感觉:又是一年网络游戏
- Android网络应用之WI-FI检测
- 网络中常用的9个命令
- ActionResult的本质四:HttpStatusCodeResult & RedirectResult/RedirectToRouteResult