标签:style blog http io ar color sp on div
/** * Created by Answer1215 on 11/22/2014. */ function AppCtrl($q, $interval) { var vm = this; vm.cancel = cancel; var timer = $interval(function(){ console.log("doing taskk"); }, 150, 10); // 150 ms, 10 times function success() { console.log("done"); } function error() { console.log("cancelled or error"); } function notify() { console.log("updating"); } timer.then(success, error, notify); function cancel() { $interval.cancel(timer); } } angular.module(‘app‘,[]) .controller(‘AppCtrl‘, AppCtrl);
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <script src="bower_components/angular/angular.min.js"></script> <script src="app.js"></script> </head> <body ng-app="app" ng-controller="AppCtrl as app"> <button ng-click="app.cancel();">cancel</button> </body> </html>
标签:style blog http io ar color sp on div
原文地址:http://www.cnblogs.com/Answer1215/p/4114651.html