Tag Archives: Angular

Angular.js Hello World program

Usually when writing a small utility I use the command line. But sometimes a simple web page with JavaScript gives a more functional UI.

I like AngularJS, but I don’t start from scratch very often, and when I do, I need to start searching for code to copy. So, here is my Angular Hello World template.

<!DOCTYPE html>
<html ng-app="theApplication" ng-controller="theController">
  <head>
    <meta charset="utf-8">
    <title>Hello World</title>
  </head>

  <script src="angular.js"></script>
  <script>
    angular.module('theApplication', []).
    controller('theController', ['$scope',function($scope) {
      $scope.name = 'Zo0ok';
    }]);
  </script>

  <body>
    Hello {{ name }}
  </body>
</html>

Obviously, if you don’t host angular.js yourself you need to use something like

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js">
</script>

instead.