Skip to content

Instantly share code, notes, and snippets.

@chriseyre2000
Created January 27, 2015 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriseyre2000/1da356f163ad7cd13ba7 to your computer and use it in GitHub Desktop.
Save chriseyre2000/1da356f163ad7cd13ba7 to your computer and use it in GitHub Desktop.
<!doctype html >
<html ng-app="myApp">
<head>
<meta charset="utf-8">
</head>
<body>
<div ng-controller="FirstController" ng-click="stopTimer()" >{{name}}</div>
<script src="node_modules/angular/angular.min.js" ></script>
<script>
var myApp = angular.module('myApp',[]);
myApp.controller('FirstController', function($scope, $timeout) {
$scope.name = "Hello Mulder";
promise = $timeout( function() { $scope.name = "Goodbye"; }, 5000);
$scope.stopTimer = function () {
$timeout.cancel(promise);
$scope.name = "Stopped";
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment