From f0fa5e63762e80fd4ee60ff6d365fca5f886292a Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 9 Nov 2011 21:18:34 -0800 Subject: doc(AUTO, NG_MOCK): Documenting the AUTO and NG_MOCK module --- docs/content/api/angular.module.NG.ngdoc | 5 +++ docs/content/api/angular.module.ngdoc | 54 ++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 docs/content/api/angular.module.NG.ngdoc create mode 100644 docs/content/api/angular.module.ngdoc (limited to 'docs/content/api') diff --git a/docs/content/api/angular.module.NG.ngdoc b/docs/content/api/angular.module.NG.ngdoc new file mode 100644 index 00000000..84bb574b --- /dev/null +++ b/docs/content/api/angular.module.NG.ngdoc @@ -0,0 +1,5 @@ +@ngdoc overview +@name angular.module.NG +@description + +The `NG` is an angular module which contains all of the core angular services. diff --git a/docs/content/api/angular.module.ngdoc b/docs/content/api/angular.module.ngdoc new file mode 100644 index 00000000..91cd311d --- /dev/null +++ b/docs/content/api/angular.module.ngdoc @@ -0,0 +1,54 @@ +@ngdoc overview +@name angular.module +@description + +The angular.module namespace is a global place for registering angular modules. All modules +(angular core or 3rd party) that should be available to an application must be registered in this +namespace. + +# Module + +A module is a function that is used to register new service providers and configure existing +providers. Once a provider is registered, {@link angular.module.AUTO.$injector $injector} will use +it to ask for a service instance when it is resolving a dependency for the first time. + +
+// Declare the module configuration function.
+// The function arguments are fully injectable so that the module function
+// can create new providers or configure existing ones.
+function MyModule($provide, $locationProvider){
+ // see $provide for more information.
+ $provide.value('appName', 'MyCoolApp');
+
+ // Configure existing providers
+ $locationProvider.hashPrefix = '!';
+};
+
+
+See: {@link angular.module.NG.$provide $provide}, {@link angular.module.NG.$locationProvider $locationProvider}.
+
+# Registering Module Function
+
+In your JavaScript file:
+
+// Create the angular.module namespace if one does not exist
+// This allows the module code to be loaded before angular.js code.
+if (!window.angular) window.angular = {};
+if (!angular.module) angular.module = {};
+
+angular.module.MyModule = function(){
+ // add configuration code here.
+};
+
+
+Then you can refer to your module like this:
+
+
+var injector = angular.injector('NG', 'MyModule')
+
+
+Or
+
+
+var injector = angular.injector('NG', angular.module.MyModule)
+
--
cgit v1.2.3