I am curious about the inner workings of AngularJS modules
After experimenting with AngularJS, I came across some puzzling observations.
Including AngularJS without registering a module
Upon including AngularJS without registering a module, I encountered incorrect output.
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="myapp">
<div>
<p>{{1+2}}</p>
</div>
</body>
Including AngularJS and registering a module
Upon properly registering the AngularJS application with a module, it functioned correctly and produced the desired output.
var app = angular.module('myapp', []);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="myapp">
<div>
<p>{{1+2}}</p>
</div>
</body>
My inquiries are...
How does AngularJS function within a module?
Is it necessary to register AngularJS with a module each time?
What is the underlying concept of AngularJS modules?