diff options
| author | Igor Minar | 2011-06-15 22:31:40 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-06-15 22:31:40 -0700 |
| commit | b842642b574a2b95c53b791308ed1bf8ff9d304d (patch) | |
| tree | fb26431c5372be74de2105df77e94dea4f198489 /docs/content/guide/dev_guide.services.managing_dependencies.ngdoc | |
| parent | d428c9910e66246c2af46602499acaeaf187d75b (diff) | |
| download | angular.js-b842642b574a2b95c53b791308ed1bf8ff9d304d.tar.bz2 | |
docs - stripping extra new lines
Diffstat (limited to 'docs/content/guide/dev_guide.services.managing_dependencies.ngdoc')
| -rw-r--r-- | docs/content/guide/dev_guide.services.managing_dependencies.ngdoc | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/docs/content/guide/dev_guide.services.managing_dependencies.ngdoc b/docs/content/guide/dev_guide.services.managing_dependencies.ngdoc index 5adbefae..5f45b001 100644 --- a/docs/content/guide/dev_guide.services.managing_dependencies.ngdoc +++ b/docs/content/guide/dev_guide.services.managing_dependencies.ngdoc @@ -3,20 +3,16 @@ @name Developer Guide: Angular Services: Managing Service Dependencies @description - Angular allows services to declare other services as dependencies needed for construction of their instances. - To declare dependencies, you specify them in the factory function signature and via the `$inject` property, as an array of string identifiers. Optionally the `$inject` property declaration can be dropped (see "Inferring `$inject`" but note that that is currently an experimental feature). - Here is an example of two services that depend on each other, as well as on other services that are provided by angular's web framework: - <pre> /** * batchLog service allows for messages to be queued in memory and flushed @@ -27,7 +23,6 @@ provided by angular's web framework: angular.service('batchLog', function($defer, $log) { var messageQueue = []; - function log() { if (messageQueue.length) { $log('batchLog messages: ', messageQueue); @@ -36,14 +31,12 @@ function log() { $defer(log, 50000); } - return function(message) { messageQueue.push(message); } }, {$inject: ['$defer', '$log']); // note how we declared dependency on built-in $defer and $log services above - /** * routeTemplateMonitor monitors each $route change and logs the current * template via the batchLog service. @@ -55,10 +48,8 @@ $route.onChange(function() { }, {$inject: ['$route', 'batchLog'], $eager: true}); </pre> - Things to notice in this example: - * The `batchLog` service depends on the built-in {@link api/angular.service.$defer $defer} and {@link api/angular.service.$log $log} services, and allows messages to be logged into the `console.log` in batches. @@ -77,20 +68,15 @@ this array with IDs and their order that the injector uses to determine which se order to inject. - - ## Related Topics - * {@link dev_guide.services.understanding_services Understanding Angular Services} * {@link dev_guide.services.creating_services Creating Angular Services} * {@link dev_guide.services.registering_services Registering Services} * {@link dev_guide.services.injecting_controllers Injecting Services Into Controllers } * {@link dev_guide.services.testing_services Testing Angular Services} - ## Related API - * {@link api/angular.service Angular Service API} * {@link api/angular.injector Angular Injector API} |
