Skip to content

Commit 29714a3

Browse files
Nima Mehanianbtford
Nima Mehanian
authored andcommitted
docs(guide/providers): fix grammar and punctuation
1 parent d5686ff commit 29714a3

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

docs/content/guide/providers.ngdoc

+17-18
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,8 @@ created by this recipe.
9797
Note: All services in Angular are singletons. That means that the injector uses each recipe at most
9898
once to create the object. The injector then caches the reference for all future needs.
9999

100-
Since Factory is more a powerful version of the Value recipe, you can construct the same service with it.
101-
Using our previous `clientId` Value recipe example, we can rewrite it as a Factory recipe like
102-
this:
100+
Since a Factory is a more powerful version of the Value recipe, the same service can be constructed with it.
101+
Using our previous `clientId` Value recipe example, we can rewrite it as a Factory recipe like this:
103102

104103
```javascript
105104
myApp.factory('clientId', function clientIdFactory() {
@@ -134,11 +133,11 @@ token.
134133

135134
<div class="alert alert-success">
136135
**Best Practice:** name the factory functions as `<serviceId>Factory`
137-
(e.g. apiTokenFactory). While this naming convention is not required, it helps when navigating the code base
136+
(e.g., apiTokenFactory). While this naming convention is not required, it helps when navigating the codebase
138137
or looking at stack traces in the debugger.
139138
</div>
140139

141-
Just like with Value recipe, Factory recipe can create a service of any type, whether it be a
140+
Just like with the Value recipe, the Factory recipe can create a service of any type, whether it be a
142141
primitive, object literal, function, or even an instance of a custom type.
143142

144143

@@ -153,7 +152,7 @@ function UnicornLauncher(apiToken) {
153152

154153
this.launchedCount = 0;
155154
this.launch = function() {
156-
// make a request to the remote api and include the apiToken
155+
// Make a request to the remote API and include the apiToken
157156
...
158157
this.launchedCount++;
159158
}
@@ -170,7 +169,7 @@ myApp.factory('unicornLauncher', ["apiToken", function(apiToken) {
170169
```
171170

172171

173-
This is, however, exactly the use-case that Service recipe is the most suitable for.
172+
This is, however, exactly the use-case that the Service recipe is the most suitable for.
174173

175174
The Service recipe produces a service just like the Value or Factory recipes, but it does so by
176175
*invoking a constructor with the `new` operator*. The constructor can take zero or more arguments,
@@ -189,7 +188,7 @@ myApp.service('unicornLauncher', ["apiToken", UnicornLauncher]);
189188
Much simpler!
190189

191190
Note: Yes, we have called one of our service recipes 'Service'. We regret this and know that we'll
192-
be somehow punished for our mis-deed. It's like we named one of our offspring 'Child'. Boy,
191+
be somehow punished for our misdeed. It's like we named one of our offspring 'Child'. Boy,
193192
that would mess with the teachers.
194193

195194

@@ -199,8 +198,8 @@ As already mentioned in the intro, the Provider recipe is the core recipe type a
199198
all the other recipe types are just syntactic sugar on top of it. It is the most verbose recipe
200199
with the most abilities, but for most services it's overkill.
201200

202-
Provider recipe is syntactically defined as a custom type that implements a `$get` method. This
203-
method is a factory function just like the one we use in Factory recipe. In fact, if you define
201+
The Provider recipe is syntactically defined as a custom type that implements a `$get` method. This
202+
method is a factory function just like the one we use in the Factory recipe. In fact, if you define
204203
a Factory recipe, an empty Provider type with the `$get` method set to your factory function is
205204
automatically created under the hood.
206205

@@ -248,7 +247,7 @@ and wires (injects) all provider instances only.
248247

249248
During application bootstrap, before Angular goes off creating all services, it configures and
250249
instantiates all providers. We call this the configuration phase of the application life-cycle.
251-
During this phase services aren't accessible because they haven't been created yet.
250+
During this phase, services aren't accessible because they haven't been created yet.
252251

253252
Once the configuration phase is over, interaction with providers is disallowed and the process of
254253
creating services starts. We call this part of the application life-cycle the run phase.
@@ -259,9 +258,9 @@ creating services starts. We call this part of the application life-cycle the ru
259258
We've just learned how Angular splits the life-cycle into configuration phase and run phase and how
260259
you can provide configuration to your application via the config function. Since the config
261260
function runs in the configuration phase when no services are available, it doesn't have access
262-
even to simple value objects created via Value recipe.
261+
even to simple value objects created via the Value recipe.
263262

264-
Since simple values, like url prefix, don't have dependencies or configuration, it is often handy
263+
Since simple values, like URL prefixes, don't have dependencies or configuration, it's often handy
265264
to make them available in both the configuration and run phases. This is what the Constant recipe
266265
is for.
267266

@@ -317,7 +316,7 @@ Let's take a look at how we would create a very simple component via the directi
317316
on the `planetName` constant we've just defined and displays the planet name, in our case:
318317
"Planet Name: Greasy Giant".
319318

320-
Since the directives are registered via Factory recipe, we can use the same syntax as with factories.
319+
Since the directives are registered via the Factory recipe, we can use the same syntax as with factories.
321320

322321
```javascript
323322
myApp.directive('myPlanet', ['planetName', function myPlanetDirectiveFactory(planetName) {
@@ -340,7 +339,7 @@ We can then use the component like this:
340339
</html>
341340
```
342341

343-
Using Factory recipes you can also define Angular's filters and animations, but the controllers
342+
Using Factory recipes, you can also define Angular's filters and animations, but the controllers
344343
are a bit special. You create a controller as a custom type that declares its dependencies as
345344
arguments for its constructor function. This constructor is then registered with a module. Let's
346345
take a look at the `DemoController`, created in one of the early examples:
@@ -351,7 +350,7 @@ myApp.controller('DemoController', ['clientId', function DemoController(clientId
351350
}]);
352351
```
353352

354-
The DemoController is instantiated via its constructor every time the app needs an instance of
353+
The DemoController is instantiated via its constructor, every time the app needs an instance of
355354
DemoController (in our simple app it's just once). So unlike services, controllers are not
356355
singletons. The constructor is called with all the requested services, in our case the `clientId`
357356
service.
@@ -365,12 +364,12 @@ To wrap it up, let's summarize the most important points:
365364
- There are five recipe types that define how to create objects: Value, Factory, Service, Provider
366365
and Constant.
367366
- Factory and Service are the most commonly used recipes. The only difference between them is that
368-
Service recipe works better for objects of custom type, while Factory can produce JavaScript
367+
the Service recipe works better for objects of a custom type, while the Factory can produce JavaScript
369368
primitives and functions.
370369
- The Provider recipe is the core recipe type and all the other ones are just syntactic sugar on it.
371370
- Provider is the most complex recipe type. You don't need it unless you are building a reusable
372371
piece of code that needs global configuration.
373-
- All special purpose objects except for Controller are defined via Factory recipes.
372+
- All special purpose objects except for the Controller are defined via Factory recipes.
374373

375374
<table class="table table-bordered code-table">
376375
<thead>

0 commit comments

Comments
 (0)