@ The beast's NG API Learning--Angular.module
Angular.module
Create a global angular module that can be used for retrieval and injection. All angular modules (angular core modules or third-party modules) that want to be implemented in the application need to use this injection mechanism.
Format: Angular.module (NAME,[REQUIRES],[CONFIGFN]);
Name:string the name of the module created.
[requires]: An array of strings represents the list of other modules that the module depends on, or an empty array if no other modules are dependent.
[CONFIGFN]: Some configuration of the module.
Using code:
Angular.module ("Demo", ["Ui.router"],function () {//config})
Angular.module is to be written after the 1.3 version, @ Beast in just use angular download is 1.2.8 version, that will start when only need to write a ngapp on the DOM element of the root node, in JS can directly function a controller, and then in the corresponding Div write ng-controller on the good. After the 1.3 version, however, the module name must be defined and created with Angular.module.
It is important to note that the third parameter is seldom used, and he is in fact the same as. config (), so most of us use. config () to configure the module, so that the wording is relatively clear, and can be placed in other JS configuration, more convenient.
There is a second parameter, today online has a small partner asked me, why according to the use of a plug-in tutorial article said the Dependency injection module name of the plug-in will error said module name errors, for this problem, @ Beast here say, if you need to use a plug-in, but you do not know or unsure of his module name, You can open the JS code of the plugin to find Angular.module ("xxx"), this XXX is the module name you need to inject into your module ...
@ The beast's angular Api learn, translate and understand--angular.module