diff options
Diffstat (limited to 'docs/content/guide/dev_guide.services.creating_services.ngdoc')
| -rw-r--r-- | docs/content/guide/dev_guide.services.creating_services.ngdoc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/content/guide/dev_guide.services.creating_services.ngdoc b/docs/content/guide/dev_guide.services.creating_services.ngdoc index 060ab38f..355d3243 100644 --- a/docs/content/guide/dev_guide.services.creating_services.ngdoc +++ b/docs/content/guide/dev_guide.services.creating_services.ngdoc @@ -2,12 +2,12 @@ @name Developer Guide: Angular Services: Creating Services @description -While angular offers several useful services, for any nontrivial application you'll find it useful +While Angular offers several useful services, for any nontrivial application you'll find it useful to write your own custom services. To do this you begin by registering a service factory function with a module either via the {@link api/angular.module Module#factory api} or directly via the {@link api/AUTO.$provide $provide} api inside of module config function. -All angular services participate in {@link di dependency injection (DI)} by registering +All Angular services participate in {@link di dependency injection (DI)} by registering themselves with Angular's DI system (injector) under a `name` (id) as well as by declaring dependencies which need to be provided for the factory function of the registered service. The ability to swap dependencies for mocks/stubs/dummies in tests allows for services to be highly @@ -76,17 +76,17 @@ angular.module('myModule', [], function($provide) { # Instantiating Angular Services -All services in Angular are instantiates services lazily, this means that a service will be created +All services in Angular are instantiated lazily. This means that a service will be created only when it is needed for instantiation of a service or an application component that depends on it. -In other words, angular won't instantiate lazy services unless they are requested directly or +In other words, Angular won't instantiate lazy services unless they are requested directly or indirectly by the application. # Services as singletons -Lastly, it is important to realize that all angular services are application singletons. This means -that there is only one instance of a given service per injector. Since angular is lethally allergic -to the global state, it is possible to create multiple injectors, each with its own instance of a +Lastly, it is important to realize that all Angular services are application singletons. This means +that there is only one instance of a given service per injector. Since Angular is lethally allergic +to global state, it is possible to create multiple injectors, each with its own instance of a given service, but that is rarely needed, except in tests where this property is crucially important. |
