/app/public/js/libs/angular/docs/partials/api/angular.module.html

https://bitbucket.org/kaiquewdev/front-in-sampa-example · HTML · 54 lines · 46 code · 8 blank · 0 comment · 0 complexity · efdc98032c65b9b38cc77241a8be8f65 MD5 · raw file

  1. <h1><code ng:non-bindable="">angular.module</code>
  2. <span class="hint">(API in module <code ng:non-bindable="">ng</code>
  3. )</span>
  4. </h1>
  5. <div><h2 id="Description">Description</h2>
  6. <div class="description"><p>The <code>angular.module</code> is a global place for creating and registering Angular modules. All
  7. modules (angular core or 3rd party) that should be available to an application must be
  8. registered using this mechanism.</p>
  9. <h3>Module</h3>
  10. <p>A module is a collocation of services, directives, filters, and configure information. Module
  11. is used to configure the <a href="api/AUTO.$injector"><code>$injector</code></a>.</p>
  12. <pre class="prettyprint linenums">
  13. // Create a new module
  14. var myModule = angular.module('myModule', []);
  15. // register a new service
  16. myModule.value('appName', 'MyCoolApp');
  17. // configure existing services inside initialization blocks.
  18. myModule.config(function($locationProvider) {
  19. // Configure existing providers
  20. $locationProvider.hashPrefix('!');
  21. });
  22. </pre>
  23. <p>Then you can create an injector and load your modules like this:</p>
  24. <pre class="prettyprint linenums">
  25. var injector = angular.injector(['ng', 'MyModule'])
  26. </pre>
  27. <p>However it's more likely that you'll just use
  28. <a href="api/ng.directive:ngApp"><code>ngApp</code></a> or
  29. <a href="api/angular.bootstrap"><code>angular.bootstrap</code></a> to simplify this process for you.</p></div>
  30. <h2 id="Usage">Usage</h2>
  31. <div class="usage"><pre class="prettyprint linenums">angular.module(name[, requires], configFn);</pre>
  32. <h3 id="Parameters">Parameters</h3>
  33. <ul class="parameters"><li><code ng:non-bindable="">name {!string} </code>
  34. <p>The name of the module to create or retrieve.</p></li>
  35. <li><code ng:non-bindable="">requires<i>(optional)</i> {Array.&lt;string&gt;=} </code>
  36. <p>If specified then new module is being created. If unspecified then the
  37. the module is being retrieved for further configuration.</p></li>
  38. <li><code ng:non-bindable="">configFn {Function} </code>
  39. <p>Option configuration function for the module. Same as
  40. <a href="api/angular.Module#config"><code>Module#config()</code></a>.</p></li>
  41. </ul>
  42. <h3 id="Returns">Returns</h3>
  43. <div class="returns"><code ng:non-bindable="">{module}</code>
  44. <p>new module with the <a href="api/angular.Module"><code>angular.Module</code></a> api.</p></div>
  45. </div>
  46. </div>