$http questions
//////1
$http.get("/api/task/165/").then(
function(a){
console.log(a);
},
function(b){
console.log(b);
}
)
.then(function(e){
console.log("e");
})
.then(function(){
console.log("err");
});
/////2
$http.get("/api/task/1651/").then(
function(a){
console.log(a);
}
)
.catch(function(err){
console.log(err);
})
.then(function(e){
return $http.get("/api/task/165/");
})
.then(function(res){
console.log(res);
})
////3
$http.get('https://api.github.com/users/peterbe/gists')
.success(function(data) {
$scope.gists = data;
})
.error(function(data, status) {
console.error('Repos error', status, data);
})
.finally(function() {
console.log("finally finished repos");
});
$http.get('https://api.github.com/users/peterbe/gists')
.then(function(response) {
$scope.gists = response.data;
})
.catch(function(response) {
console.error('Gists error', response.status, response.data);
})
.finally(function() {
console.log("finally finished gists");
});
随机推荐
- 十一 web爬虫讲解2—Scrapy框架爬虫—Scrapy使用
xpath表达式 //x 表示向下查找n层指定标签,如://div 表示查找所有div标签 /x 表示向下查找一层指定的标签 /@x 表示查找指定属性的值,可以连缀如:@id @src [@属性名称= ...
- [转]Python读写文件
1.open使用open打开文件后一定要记得调用文件对象的close()方法.比如可以用try/finally语句来确保最后能关闭文件. file_object = open('thefile.txt ...
- Thrift之java实例
一.java实例 1.下载与安装thrift工具 http://thrift.apache.org/download/ .服务器代码 服务Test实现类 package com.zychen.thri ...
- JMX心得 -- Server端
关于什么是JMX,这里引用了网上找来的一个介绍:JMX(JavaManagement Extensions)是一个为应用程序植入管理功能的框架.JMX是一套标准的代理和服务,实际上,用户可以在任何Ja ...
- ubuntu在anaconda2下安装anaconda3环境 && 在Pycharm中配置Python3
适合在已经装有anaconda2环境的机器上配置anaconda3环境(或在有anaconda3的环境下再配置2). 1. 下载 anaconda3 下载地址: 推荐清华镜像 https:/ ...
- Gatling:开源压力测试框架之入门
Gatling是一款开源的压力测试工具,基于Scala, Akka and Netty. 可录制测试脚本,也可以手动编写脚本,适合有编程经验的测试人员使用: 支持测试用例的参数化,可以使用csv.js ...
- FreeMarker配置详解
首先需要添加freemarker.jar到项目,如果项目中有spring或者spirngmvc,需要整合,首先配置freemarkerConfig,代码结构如下: <!-- 设置 ...
- ExpressionTree,Emit,反射
ExpressionTree,Emit,反射 https://www.cnblogs.com/7tiny/p/9861166.html [前言] 前几日心血来潮想研究着做一个Spring框架,自然地就 ...
- iOS开发单例模式 dispatch_once
什么是单例 单例模式是一种常用的软件设计模式.在它的核心结构中只包含一个被称为单例类的特殊类.通过单例模式可以保证系统中一个类只有一个实例而且该实例易于外界访问,从而方便对实例个数的控制并节约系统资源 ...
- WPF导学目录
很早就知道WPF这个东西,做项目中没用到,也就没去整理学习.作为winForm的升级版,未来windows桌面应用程序的趋势,有些公司招聘需求中也会提到熟悉WPF,于是就整理学习了一下WPF. 主要参 ...