bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!

AngularJS Modules

 

Modules in AngularJS define an application. These are used to divide the logic such as controllers, services, application etc. and keep the code clean. It is define in separate js file. Controllers always belong to a module.

Example

<!DOCTYPE html>

<html>

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

<body>

<div ng-app="intellipaatApp" ng-controller="intellipaatCtrl">

{{ first + " " + second }}

</div>

<script>

var app = angular.module("intellipaatApp", []);  // Application Module

app.controller("intellipaatCtrl", function($scope) {  // Controller Module

$scope.first = "Hello";

$scope.second = "Intellipaat";

});

</script>

</body>

</html>

Output

Hello Intellipaat

 

Modules and Controllers in Files

e.g.

<!DOCTYPE html>

<html>

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

<body>

<div ng-app="intellipaatApp" ng-controller="intellipaatCtrl">// User Module

{{first + " " + second}}

</div>

<script src="intellipaatApp.js"></script>

<script src="intellipaatCtrl.js"></script>

</body>

</html>

Output

Hello Intellipaat

In this example intellipaatApp.js have an application module definition and intellipaatCtrl.js have the controller

"0 Responses on AngularJS Modules"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

top

Sales Offer

  • To avail this offer, enroll before 09th December 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free AngularJS Modules.