Created
July 20, 2014 15:13
-
-
Save whisher/03c91973c376e9f4011e to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
| <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script> | |
| </head> | |
| <body> | |
| <div ng-controller="MyController"> | |
| <h1>Hello {{ clock.now }}!</h1> | |
| </div> | |
| <script type="text/javascript"> | |
| angular.module('myApp', []) | |
| .controller('MyController',function($scope){ | |
| $scope.clock = { | |
| now :new Date() | |
| }; | |
| var updateClock = function() { | |
| $scope.clock.now = new Date(); | |
| }; | |
| setInterval(function() { | |
| $scope.$apply(updateClock); | |
| }, 1000); | |
| updateClock(); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment