AngularJS modules


  Translation results:

Module defines an application.

Modules are containers for different parts of your application.

Modules are containers for application controllers.

Controllers usually belong to a module.

AngularJS modulessyntax

You can create modules through the angular.module function of AngularJS

AngularJS modulesexample

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.bootcss.com/angular.js/1.4.6/angular.min.js"></script> 
</head>
<body>

<div ng-app="myApp" ng-controller="myCtrl">
{{ firstName + " " + lastName }}
</div>

<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
    $scope.firstName = "John";
    $scope.lastName = "Doe";
});
</script>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A