Created
January 27, 2015 21:10
-
-
Save chriseyre2000/1da356f163ad7cd13ba7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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