The largest Interview Solution Library on the web



Warning: include(../../menu/leftMenu/angularjs-starttimeandstoptime.php) [function.include]: failed to open stream: No such file or directory in /home/javatech/public_html/question/angularjsexample/angularjs-starttimeandstoptime.php on line 36

Warning: include(../../menu/leftMenu/angularjs-starttimeandstoptime.php) [function.include]: failed to open stream: No such file or directory in /home/javatech/public_html/question/angularjsexample/angularjs-starttimeandstoptime.php on line 36

Warning: include() [function.include]: Failed opening '../../menu/leftMenu/angularjs-starttimeandstoptime.php' for inclusion (include_path='.:/opt/alt/php53/usr/share/pear:/opt/alt/php53/usr/share/php') in /home/javatech/public_html/question/angularjsexample/angularjs-starttimeandstoptime.php on line 36
« Previous | 1 | 2 | 3 | Next »
{{ Message | date:'HH:mm:ss'}}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
</style>
</head>
<body>
<script type="text/javascript" src="https://javatechnologycenter.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', [])
app.controller('MyController', function ($scope, $interval) {
//Initiate the Timer object.
$scope.Timer = null;
//Timer start function.
$scope.StartTimer = function () {
//Set the Timer start message.
$scope.Message = "Timer started. ";
//Initialize the Timer to run every 1000 milliseconds i.e. one second.
$scope.Timer = $interval(function () {
//Display the current time.
$scope.Message = new Date();
}, 1000);
};
//Timer stop function.
$scope.StopTimer = function () {
//Set the Timer stop message.
$scope.Message = "Timer stopped.";
//Cancel the Timer.
if (angular.isDefined($scope.Timer)) {
$interval.cancel($scope.Timer);
}
};
});
</script>
<div ng-app="MyApp" ng-controller="MyController">
<div>
{{ Message | date:'HH:mm:ss'}}
</div>
<br/>
<input type="button" value="Start Timer" ng-click="StartTimer()" />
<input type="button" value="Stop Timer" ng-click="StopTimer()" />
</div>
</body>
</html>
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com