Namepy step 1 – Angular “Hello World”

(This is part of the namepy project. Start at Namepy – on the shoulders of giants)

Let’s make a very simple start, with a webpage with a basic Angular controller, just enough to show that Angular is loaded and active.

Each step will build upon the previous and will live in its own folder/subpath. The external libraries will live in “external”.

Full code is in the git repo. The step-by-step instructions contain only the most relevant, new and/or tricky parts

  1. Download latest version of Angular from https://angularjs.org/ and store in project_root/external
  2. For date processing we’ll be using MomentJs. Download it from http://momentjs.com/ and store in project_root/external
  3. Create a html page, called helloworld.html and save it in project_ root
  4. Load angular.js and moment.js, using the <script src=”…”></script> tag
  5. Create a simple Angular module and controller
    angular.module('HelloWorldApp', [])
    .controller('HelloWorldController', function($scope) {
    $scope.dateToday = moment().format('MMMM Do YYYY')
    });
    
  6. Load the module and controller:
    <body ng-app="HelloWorldApp" ng-controller="HelloWorldController"</body>
    
  7. Create a curly-bracket expression to show the dateToday
    Welcome, today is {{dateToday}}
    
  8. Save the page

Done

Next

Continue to Step 2 – Flask and Angular