angularjs basic set up

by Richard Hunter

HTML

<script src="//code.angularjs.org/1.8.0/angular.min.js"></script>
<div ng-app="myModule" ng-controller="Controller">
 {{name}}
 <my-hello title="my cool directive"></my-hello>
</div>

JavaScript

(function(angular) {

	function rootController($scope) {
  	$scope.name = 'richard';
  }
  
  rootController.$inject = ['$scope'];
  
	angular.module('myModule', [])
  	.controller('Controller', rootController)
    .directive('myHello', function() {
    	return {
      	scope: {
        	title: '@title',
        },
      	template: `
        	<div>
        		<h2>{{title}}</h2>
          </div>
         `
      };
    });

} (window.angular));