@@ -2,10 +2,10 @@ include ../_util-fns
2
2
3
3
a( id ='top' )
4
4
:marked
5
- Our app should be able to make the browser title bar say whatever we want it to say.
5
+ Your app should be able to make the browser title bar say whatever you want it to say.
6
6
This cookbook explains how to do it.
7
7
:marked
8
- ** See the <live-example name="cb-set-document-title"></live-example>** .
8
+ See the <live-example name="cb-set-document-title"></live-example>.
9
9
10
10
table
11
11
tr
@@ -28,11 +28,11 @@ code-example(format='').
28
28
< title> {{This_Does_Not_Work}}< /title>
29
29
:marked
30
30
Sorry but that won't work.
31
- The root component of our application is an element contained within the `<body>` tag.
31
+ The root component of the application is an element contained within the `<body>` tag.
32
32
The HTML `<title>` is in the document `<head>`, outside the body, making it inaccessible to Angular data binding.
33
33
34
- We could grab the browser `document` object and set the title manually.
35
- That's dirty and undermines our chances of running the app outside of a browser someday.
34
+ You could grab the browser `document` object and set the title manually.
35
+ That's dirty and undermines your chances of running the app outside of a browser someday.
36
36
.l-sub-section
37
37
:marked
38
38
Running your app outside a browser means that you can take advantage of server-side
@@ -46,19 +46,19 @@ code-example(format='').
46
46
The [Title](../api/platform-browser/index/Title-class.html) service is a simple class that provides an API
47
47
for getting and setting the current HTML document title:
48
48
49
- * `getTitle() : string` — Gets the title of the current HTML document.
50
- * `setTitle( newTitle : string )` — Sets the title of the current HTML document.
49
+ * `getTitle() : string`—Gets the title of the current HTML document.
50
+ * `setTitle( newTitle : string )`—Sets the title of the current HTML document.
51
51
52
- Let's inject the `Title` service into the root `AppComponent` and expose a bindable `setTitle` method that calls it:
52
+ You can inject the `Title` service into the root `AppComponent` and expose a bindable `setTitle` method that calls it:
53
53
54
54
+ makeExample( "cb-set-document-title/ts/src/app/app.component.ts" , "class" , "src/app/app.component.ts (class)" )( format ='.' )
55
55
:marked
56
- We bind that method to three anchor tags and, voilà!
56
+ Bind that method to three anchor tags and voilà!
57
57
figure.image-display
58
58
img( src ="/resources/images/cookbooks/set-document-title/set-title-anim.gif" alt ="Set title" )
59
59
60
60
:marked
61
- Here's the complete solution
61
+ Here's the complete solution:
62
62
63
63
+ makeTabs(
64
64
` cb-set-document-title/ts/src/main.ts,
@@ -76,17 +76,18 @@ figure.image-display
76
76
77
77
.l-main-section
78
78
:marked
79
- ## Why we provide the *Title* service in *bootstrap*
79
+ ## Why provide the *Title* service in *bootstrap*
80
80
81
- We generally recommended providing application-wide services in the root application component, `AppComponent`.
81
+ Generally you want to provide application-wide services in the root application component, `AppComponent`.
82
82
83
- Here we recommend registering the title service during bootstrapping,
84
- a location we reserve for configuring the runtime Angular environment.
83
+ This cookbook recommends registering the title service during bootstrapping,
84
+ a location you reserve for configuring the runtime Angular environment.
85
85
86
- That's exactly what we 're doing.
86
+ That's exactly what you 're doing.
87
87
The `Title` service is part of the Angular *browser platform*.
88
- If we bootstrap our application into a different platform,
89
- we'll have to provide a different `Title` service that understands the concept of a "document title" for that specific platform.
90
- Ideally the application itself neither knows nor cares about the runtime environment.
88
+ If you bootstrap your application into a different platform,
89
+ you'll have to provide a different `Title` service that understands
90
+ the concept of a "document title" for that specific platform.
91
+ Ideally, the application itself neither knows nor cares about the runtime environment.
91
92
:marked
92
93
[Back to top](#top)
0 commit comments