Skip to content

Instantly share code, notes, and snippets.

@kuzmicheff
Created September 16, 2017 16:19
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 kuzmicheff/160cfef7c42145b9464867469dedb3f5 to your computer and use it in GitHub Desktop.
Save kuzmicheff/160cfef7c42145b9464867469dedb3f5 to your computer and use it in GitHub Desktop.
Simple clock in AngularJS
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope, $interval) {
$scope.theTime = new Date().toLocaleTimeString();
$interval(function() {
$scope.theTime = new Date().toLocaleTimeString();
}, 1000);
});
<div ng-app="myApp" ng-controller="myCtrl">
<p>
{{theTime}}
</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment