angular点击按钮倒计时
$rootScope.timer = function(time, buttonid) {
var btn = $(buttonid);
btn.attr("disabled", true); //按钮禁止点击
// btn.html(time <= 0 ? "发送动态密码" : ("" + (time) + "秒后可发送"));
var hander = setInterval(function() {
if (time <= 0) {
clearInterval(hander); //清除倒计时
btn.html("发送验证码");
btn.attr("disabled", false);
return false;
} else {
btn.html("" + (time--) + "秒后可发送");
}
}, 1000);
};