angularjs-$interval使用
1. 简单使用
var app = angular.module("app",[]);
app.controller("AppCtrl", function($q. $interval){
var timer = $interval(function(){
},1000,3);// 表示每一秒执行一次,执行三次
timer.then(success); // 三次成功后调用对应的函数
function success(){
console.log("done");
}
})
2.错误的处理,和每次调用的处理
var timer = $interval(function(){},100, 10);
timer.then(success, error, notify);
function success(){
console.log("done");
}
function error(){
console.log("error");
}
function notify(){
console.log("每次都更新"); // 一般来说每次的要更新的都放在这里
}
3.取消
// 通过$interval.cancle(timer);
var timer = $interval(function(){},100, 10);
this.cancel = function(){
$interval.cancel(timer);
}
angularjs-$interval使用的更多相关文章
- 一篇入门AngularJS
目录 1.AngularJS 应用 2.AngularJS 指令 3.AngularJS 表达式 4.AngularJS 模型 5.AngularJS 控制器 6.AngularJS 作用域 7.An ...
- Failure to find xxx in xxx was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced @ xxx
问题: 在linux服务器上使用maven编译war时报错: 16:41:35 [FATAL] Non-resolvable parent POM for ***: Failure to find * ...
- [LeetCode] Find Right Interval 找右区间
Given a set of intervals, for each of the interval i, check if there exists an interval j whose star ...
- [LeetCode] Insert Interval 插入区间
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessa ...
- angularjs 中的setTimeout(),setInterval() / $interval 和 $timeout
$interval window.setInterval的Angular包装形式.Fn是每次延迟时间后被执行的函数. 间隔函数的返回值是一个承诺.这个承诺将在每个间隔刻度被通知,并且到达规定迭代次数后 ...
- MySQL interval()函数
INTERVAL(N,N1,N2,N3,..........) INTERVAL()函数进行比较列表(N,N1,N2,N3等等)中的N值.该函数如果N<N1返回0,如果N<N2返回1,如果 ...
- oracle11g interval(numtoyminterval())自动创建表分区
Oracle11g通过间隔分区实现按月创建表分区 在项目数据库设计过程中由于单表的数据量非常庞大,需要对表进行分区处理.由于表中的数据是历史交易,故按月分区,提升查询和管理. 由于之前对于表分区了解不 ...
- maven执行报错resolution will not be reattempted until the update interval of nexus h
maven在执行过程中抛错: 引用 ... was cached in the local repository, resolution will not be reattempted until t ...
- 7_nodejs angularjs
webstrom使用: ctrl+b/点击,代码导航,自动跳转到定义 ctrl+n跳转指定类 ctrl+d复制当前行ctrl+enter另起一行ctrl+y删除当前行 ctrl+alt/shift+b ...
- Leetcode Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessa ...
随机推荐
- java 16-8 泛型高级之通配符
泛型高级(通配符) ?:任意类型,如果没有明确,那么就是Object以及任意的Java类了 ? extends E:向下限定,E及其子类 ? super E:向上限定,E极其父类 import jav ...
- vs2012无法启动已配置的开发Web服务器
] 有些教程说要开,我就没懂了
- usb驱动开发6之端点描述符
学到这里不容易,先说一段故事吧. 二兄弟住一大楼的第80层,某深夜回家忘看通知(内容今夜停电). 兄弟俩背着沉重的大背包,在楼底下商量一下,决定一鼓作气,爬楼梯回家.两人抖擞精神,开始爬楼.爬到20楼 ...
- Memcached通用类(基于enyim.com Memcached Client)
一.如果用官方提供的方法,在web.config里面配置好了各个参数和服务器IP.如下图: <?xml version="1.0"?> <configuratio ...
- Caffe学习系列(8):solver优化方法
上文提到,到目前为止,caffe总共提供了六种优化方法: Stochastic Gradient Descent (type: "SGD"), AdaDelta (type: &q ...
- word2010 数学公式/联立方程/大括号内方程组如何左对齐?
如何在word中输入的联立方程使其条件左对齐? 如输入: 实现如下对齐: 就是在每个逗号 .前输入一个 & 号就可以了, 注意这个逗号一定要是 位于这个方框里头,然后在其前面输入 & ...
- java web 的标准目录结构(zz)
http://blog.csdn.net/bluesnail216/article/details/7744607 --yourproject --src --java 运行的j ...
- [CareerCup] 2.1 Remove Duplicates from Unsorted List 移除无序链表中的重复项
2.1 Write code to remove duplicates from an unsorted linked list.FOLLOW UPHow would you solve this p ...
- [CareerCup] 9.3 Magic Index 魔法序号
9.3 A magic index in an array A[0.. .n-1] is defined to be an index such that A[i] = i. Given a sort ...
- [MetaHook] R_RicochetSprite
By hzqst void R_RicochetSprite(float *pos, model_t *pmodel, float duration, float scale) { TEMPENTIT ...