Angular Module

Sample illustration to create module in angular

by Kamal Rawat

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0/angular.min.js"></script>
<div ng-app="myModule">
    <div ng-controller="myController">
        {{  message  }}
    </div>
</div>

JavaScript

// creating module
var myapp = angular.module("myModule",[]);


//registering and creating controller
myapp.controller("myController",function($scope){
	//attaching errormessage as a property to $scope
	$scope.errormessage = 'You got an exception';
});