Skip to content

Commit b426424

Browse files
mjfroehlichbtford
mjfroehlich
authored andcommitted
docs(guide/providers): minor edits
1 parent e1d6178 commit b426424

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/content/guide/providers.ngdoc

+7-7
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ On to more complex examples!
8383
## Factory Recipe
8484

8585
The Value recipe is very simple to write, but lacks some important features we often need when
86-
creating services. Let's now look at the Value recipe's more powerful sibling, the Factory.The
86+
creating services. Let's now look at the Value recipe's more powerful sibling, the Factory. The
8787
Factory recipe adds the following abilities:
8888

8989
* ability to use other services (have dependencies)
@@ -97,7 +97,7 @@ 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 powerful version of Value recipe, you can construct the same service with it.
100+
Since Factory is more powerful version of the Value recipe, you can construct the same service with it.
101101
Using our previous `clientId` Value recipe example, we can rewrite it as a Factory recipe like
102102
this:
103103

@@ -111,8 +111,8 @@ But given that the token is just a string literal, sticking with the Value recip
111111
appropriate as it makes the code easier to follow.
112112

113113
Let's say, however, that we would also like to create a service that computes a token used for
114-
authentication against a remote API. This token will be called 'apiToken' and will be computed
115-
based on the `clientId` value and a secret stored in browser's local storage:
114+
authentication against a remote API. This token will be called `apiToken` and will be computed
115+
based on the `clientId` value and a secret stored in the browser's local storage:
116116

117117
```javascript
118118
myApp.factory('apiToken', ['clientId', function apiTokenFactory(clientId) {
@@ -132,7 +132,7 @@ In the code above, we see how the `apiToken` service is defined via the Factory
132132
on `clientId` service. The factory service then uses NSA-proof encryption to produce an authentication
133133
token.
134134

135-
Note: It is a best practice to name the factory functions as "<serviceId>Factory"
135+
Note: It is best practice to name the factory functions as `<serviceId>Factory`
136136
(e.g. apiTokenFactory). While this naming convention is not required, it helps when navigating the code base
137137
or looking at stack traces in the debugger.
138138

@@ -143,7 +143,7 @@ primitive, object literal, function, or even an instance of a custom type.
143143
## Service Recipe
144144

145145
JavaScript developers often use custom types to write object-oriented code. Let's explore how we
146-
could launch a unicorn into space via our `unicornLauncher` service that is an instance of
146+
could launch a unicorn into space via our `unicornLauncher` service which is an instance of a
147147
custom type:
148148

149149
```javascript
@@ -187,7 +187,7 @@ myApp.service('unicornLauncher', ["apiToken", UnicornLauncher]);
187187
Much simpler!
188188

189189
Note: Yes, we have called one of our service recipes 'Service'. We regret this and know that we'll
190-
be somehow punished for our mis-deed. It's like we named one of our offspring 'Children'. Boy,
190+
be somehow punished for our mis-deed. It's like we named one of our offspring 'Child'. Boy,
191191
that would mess with the teachers.
192192

193193

0 commit comments

Comments
 (0)