yyApp = angular.module("myApp", [)s
smyApp.controller("myContrller’ function scope) {
‘Sscopemessuge = "Hello Angular World!" Maile
» 3
<
Output :
AngularJS Module Demo:
Hello Angular World!
In the shove example, we created application module
and controller in the same HTML. file, However, we can
create separate JavaSeript files for each module as shown
below.
‘
‘
<[body>
(MU-New Syllabus wes academic year 21-22) (M6-104)
IB rechneo Publications. SACHIN SHAH Venture
nracsemarisneaborectomieen Ey studocu
Downlaadad by Nogre Shibja(vut!2021007 @pvpnco8.20.n)Wb .0 (MU-Sem 6-17)
{itroduation to Angulax8)...Page no. (3-8)
File Name: apps
var myApp = angular.module("myApp", ))
File Name: myController,js
‘myApp.controler("myContrller,funetion (Sscope) {
Secopesmessage ~ "Hello Angular World!";
Ys
Example 2 : Here, we use application module using ng-
app ditective, and conuoller using ngcontoller directive.
We import the mainApp.js and studentControllerjs in the
‘main HTML page. In mainApp.s we declare an application
mainApp module using angular.module function and pass
aan emply array to it. This array generally contains dependent
modules. In studentControllerjs, we declare a controller
studentController module
using mainApp.controller
function,
File Name: testAngularJS html
Angular JS Modules
‘
‘