1. Create Module
The first parameter is the name of the module var head=angular.module (' Headapp ', []); Head.controller ("User", "$scope", function ($scope) {$scope. Username= "admin"; $scope. Logintime=new Date (). toString ();}]);
2. Create module and rely on other module
Create module and this module depends on other modules//the second parameter is dependent on the block name if you do not rely on any modules to pass an empty array []. Note: If the second argument is not passed, it is the module var my=angular.module (' myApp ', ["Headapp"]) that gets the current name, My.controller ("Content", ["$scope", function ($scope) {$scope. Text= "This is a test page";}]);
3, different module has the same controller when the call mode
If the current module and the dependency have the same controller, the controller for the current module is called. When the current module does not have this controller, the controller//in the dependent module is called to comment (or uncomment) the following controller code, depending on the effect of the page//My.controller ("User", ["$scope ", function ($scope) {//$scope. Username= "admin123";//$scope. Logintime= "2015-7-25";//}]);
The
Demo code is as follows:
<! DOCTYPE html>
Poke Code test Address
Angularjs--module