AngularJS is distributed as a JavaScript file, and can be added to a HTML page with a <script> tag.
The AngularJS application is defined by ng-app="myApp". The application runs inside the <div> tag. It’s also used to define a <div> tag as a root element.
The ng-controller=”moduleCtrl” is an AngularJS directive. It is used to assign a controller name as “moduleCtrl”.
{{firstWord+” “+secondWord+” “+thirdWord}} is a string concatenation code of the myApp application for AngularJS. The {{ }} is used to bind the value of the application variable.
Here we create an module by using angular.module function. We have passed an empty array to it.
Here we have declared a controller moduleCtrl module using apps.controller() function.
The value of the controller modules is stored in scope object. In AngularJS, $scope is passed as first argument to apps.controller during its constructor definition.
Here we have set the value of $scope.firstWord, $scope.secondWord and $scope.thirdWord which are to be used to display the {{firstWord+” “+secondWord+” “+thirdWord}} values in the HTML <div> element.
Sample Output for Modules in AngularJS :
The output shows a concatenation of a three string {{firstWord+” “+secondWord+ “ “+ thirdWord}}.