Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit e51f569

Browse files
committed
clean up last section and code includes
1 parent 5f40a6e commit e51f569

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

public/docs/_examples/dependency-injection/dart/lib/providers_component.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,18 @@ class ProviderComponent6b {
167167
}
168168
}
169169

170-
// #docregion configurable-logger
170+
// #docregion opaque-token
171171
const loggerPrefix = const OpaqueToken('Logger prefix');
172+
// #enddocregion opaque-token
172173

174+
// #docregion configurable-logger
173175
@Injectable()
174176
class ConfigurableLogger extends Logger {
175177
final String _prefix;
176178

179+
// #docregion use-opaque-token
177180
ConfigurableLogger(@Inject(loggerPrefix) this._prefix);
181+
// #enddocregion use-opaque-token
178182

179183
@override
180184
void log(String msg) {

public/docs/dart/latest/guide/dependency-injection.jade

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ code-example(format, language="html").
160160
+makeExample('dependency-injection/dart/lib/providers_component.dart','providers-1')
161161
+includeShared('{ts}', 'providers-provide-2')
162162
+makeExample('dependency-injection/dart/lib/providers_component.dart','providers-2')
163+
// includeShared('{ts}', 'providers-provide-3')
164+
// includeShared('{ts}', 'providers-provide-4-1')
163165
// Don't discuss provide function.
164166
:marked
165167
We supply two arguments to the `Provider` constructor.
@@ -254,22 +256,16 @@ code-example(format, language="html").
254256
every class implicitly defines an interface,
255257
so interface names are just class names.
256258
+includeShared('{ts}', 'tokens-non-class-deps-1')
257-
[PENDING: fix!!]
258-
+makeExample('dependency-injection/dart/lib/app_config.dart','config','lib/app_config.dart (excerpt)')(format='.')
259259
:marked
260260
We know we can register an object with a [value provider](#value-provider).
261261
But what do we use for the token?
262262
+includeShared('{ts}', 'tokens-opaque-1')
263-
+makeExample('dependency-injection/dart/lib/app_config.dart','token')(format='.')
263+
+makeExample('dependency-injection/dart/lib/providers_component.dart','opaque-token')(format='.')
264264
+includeShared('{ts}', 'tokens-opaque-2')
265-
+makeExample('dependency-injection/dart/lib/providers_component.dart','providers-9')(format=".")
266-
+includeShared('{ts}', 'tokens-opaque-3')
267-
+makeExample('dependency-injection/dart/lib/app_component.dart','providers', 'lib/app_component.dart (providers)')(format=".")
268-
+makeExample('dependency-injection/dart/lib/app_component.dart','ctor', 'lib/app_component.dart (constructor)')(format=".")
269-
265+
+makeExample('dependency-injection/dart/lib/providers_component.dart','use-opaque-token')(format=".")
270266
:marked
271267
Here's an example of providing configuration information
272-
for an injected class. First define the configurable class:
268+
for an injected class. First define the class:
273269
+makeExample('dependency-injection/dart/lib/providers_component.dart','configurable-logger')(format=".")
274270
:marked
275271
Then inject that class and its configuration information:

public/docs/ts/latest/guide/dependency-injection.jade

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -752,17 +752,17 @@ code-example(format, language="html").
752752
- var lang = current.path[1]
753753
- var objectexamples = lang == 'dart' ? 'a string or list literal, or maybe a function' : 'a string, a function, or an object'
754754
// Is function injection useful? Should we show it?
755-
- var hashes = lang == 'dart' ? 'They might be maps like this one:' : 'They tend to be object hashes like this one:'
756755
:marked
757756
### Non-class dependencies
758757

759758
What if the dependency value isn't a class?
760759
Sometimes the thing we want to inject is #{objectexamples}.
760+
// #enddocregion tokens-non-class-deps-1
761761
762-
762+
// TS/JS only
763+
:marked
763764
Applications often define configuration objects with lots of small facts like the title of the application or the address of a web API endpoint.
764-
These configuration objects aren't always instances of a class. #{hashes}
765-
// #enddocregion tokens-non-class-deps-1
765+
These configuration objects aren't always instances of a class. They tend to be object hashes like this one:
766766
+makeExample('dependency-injection/ts/app/app.config.ts','config','app/app-config.ts (excerpt)')(format='.')
767767

768768
// TypeScript only?
@@ -805,9 +805,10 @@ code-example(format, language="html").
805805
// #docregion tokens-opaque-2
806806
- var lang = current.path[1]
807807
- var decorated = lang == 'dart' ? 'annotated' : 'decorated'
808+
- var configuration = lang == 'dart' ? '' : 'configuration'
808809
:marked
809-
Now we inject the configuration object into any constructor that needs it, with
810-
the help of an `@Inject` #{decorator} that tells Angular how to find the configuration dependency value.
810+
Now we can inject the #{configuration} object into any constructor that needs it, with
811+
the help of an `@Inject` #{decorator} that tells Angular how to find the #{configuration} dependency value.
811812
// #enddocregion tokens-opaque-2
812813
+makeExample('dependency-injection/ts/app/providers.component.ts','provider-9b-ctor')(format=".")
813814

@@ -819,10 +820,9 @@ code-example(format, language="html").
819820
:marked
820821
// end typescript only
821822
822-
// #docregion tokens-opaque-3
823+
// Skip for Dart (we have another example)
823824
:marked
824825
Or we can provide and inject the configuration object in our top-level `AppComponent`.
825-
// #enddocregion tokens-opaque-3
826826
+makeExample('dependency-injection/ts/app/app.component.ts','providers', 'app/app.component.ts (providers)')(format=".")
827827
+makeExample('dependency-injection/ts/app/app.component.ts','ctor', 'app/app.component.ts (constructor)')(format=".")
828828

0 commit comments

Comments
 (0)