@@ -36,7 +36,7 @@ a(id="from-ts")
36
36
:marked
37
37
## From TS to ES6 to ES5
38
38
39
- Since TypeScript is a superset of ES6 Javascript , and ES6 itself is a superset of ES5, the
39
+ Since TypeScript is a superset of ES6 JavaScript , and ES6 itself is a superset of ES5, the
40
40
transformation of Typescript code all the way to ES5 javascript can be seen as "shedding"
41
41
features.
42
42
@@ -47,12 +47,12 @@ a(id="from-ts")
47
47
such as `public` and `private`.
48
48
The exception is type annotations used for dependency injection, which can be kept.
49
49
50
- Going from ES6 with decorators to plan ES6 Javascript we lose all
50
+ Going from ES6 with decorators to plain ES6 JavaScript we lose all
51
51
[decorators](https://www.typescriptlang.org/docs/handbook/decorators.html)
52
- the remaining type annotations.
52
+ and the remaining type annotations.
53
53
We also lose class properties, which now have to be declared in the class constructor.
54
54
55
- Finally, in the transition from ES6 to ES5 Javascript the main missing features are `import`
55
+ Finally, in the transition from ES6 to ES5 JavaScript the main missing features are `import`
56
56
statements and `class` declarations.
57
57
58
58
For ES6 transpilation we recommend using a similar setup as our TypeScript quickstart,
@@ -67,7 +67,7 @@ a(id="modularity")
67
67
68
68
### Importing Angular Code
69
69
70
- In TypeScript and ES6 Javascript , Angular classes, functions, and other members are imported
70
+ In TypeScript and ES6 JavaScript , Angular classes, functions, and other members are imported
71
71
with ES6 `import` statements.
72
72
73
73
In ES5 JavaScript code, when using [the Angular packages](../glossary.html#!#scoped-package),
@@ -86,21 +86,21 @@ a(id="modularity")
86
86
ng2import
87
87
` ,`
88
88
Typescript,
89
- ES6 Javascript with decorators,
90
- ES6 Javascript ,
91
- ES5 Javascript
89
+ ES6 JavaScript with decorators,
90
+ ES6 JavaScript ,
91
+ ES5 JavaScript
92
92
` )
93
93
94
94
:marked
95
95
### Importing and Exporting Application Code
96
96
97
- Each file in an Angular TypeScript or ES6 Javascript application constitutes a ES6 module.
97
+ Each file in an Angular TypeScript or ES6 JavaScript application constitutes a ES6 module.
98
98
When we want to make something from a module available to other modules, we `export` it.
99
99
100
100
In an Angular ES5 JavaScript application, we load each file to the page using a `<script>` tag.
101
101
Each file can make things available to other files via the shared global `window` scope.
102
102
103
- We often introduce an application namespace object (such as `" app" `) onto `window` and attach
103
+ We often introduce an application namespace object (such as `app`) onto `window` and attach
104
104
everything we need to share to that namespace object.
105
105
We also wrap our code in an
106
106
[Immediately Invoked Function Expression (IIFE)](https://en.wikipedia.org/wiki/Immediately-invoked_function_expression).
@@ -118,16 +118,16 @@ a(id="modularity")
118
118
appexport
119
119
` ,`
120
120
Typescript,
121
- ES6 Javascript with decorators,
122
- ES6 Javascript ,
123
- ES5 Javascript
121
+ ES6 JavaScript with decorators,
122
+ ES6 JavaScript ,
123
+ ES5 JavaScript
124
124
` )
125
125
126
126
:marked
127
- Using Typescript or ES6 Javascript , in other modules we can then `import` things that have been exported
127
+ Using Typescript or ES6 JavaScript , in other modules we can then `import` things that have been exported
128
128
elsewhere.
129
129
130
- On ES5 Javascript we can access anything using the shared namespace in other files.
130
+ In ES5 JavaScript we can access anything using the shared namespace in other files.
131
131
Note that the order of `<script>` tags on the page is significant.
132
132
We must load a file that defines a shared member before a file that uses that member.
133
133
@@ -143,9 +143,9 @@ a(id="modularity")
143
143
appimport
144
144
` ,`
145
145
Typescript,
146
- ES6 Javascript with decorators,
147
- ES6 Javascript ,
148
- ES5 Javascript
146
+ ES6 JavaScript with decorators,
147
+ ES6 JavaScript ,
148
+ ES5 JavaScript
149
149
` )
150
150
151
151
.alert.is-helpful
@@ -164,7 +164,7 @@ a(id="class-metadata")
164
164
165
165
### Classes
166
166
167
- We put most of our Angular TypeScript or ES6 Javascript code into classes. ES6 without decorators
167
+ We put most of our Angular TypeScript or ES6 JavaScript code into classes. ES6 without decorators
168
168
also does not have support for class properties, so they must be assigned inside the constructor.
169
169
170
170
ES5 JavaScript has no classes. We use the constructor pattern instead which works with
@@ -182,9 +182,9 @@ a(id="class-metadata")
182
182
constructorproto
183
183
` ,`
184
184
Typescript,
185
- ES6 Javascript with decorators,
186
- ES6 Javascript ,
187
- ES5 Javascript
185
+ ES6 JavaScript with decorators,
186
+ ES6 JavaScript ,
187
+ ES5 JavaScript
188
188
` )
189
189
190
190
:marked
@@ -196,12 +196,12 @@ a(id="class-metadata")
196
196
For example, a component must have a
197
197
[`@Component`](../api/core/index/Component-decorator.html) decorator.
198
198
199
- On ES5/6 Javascript we can instead attach an `annotations` array to a class/constructor
199
+ In ES5/6 JavaScript we can instead attach an `annotations` array to a class/constructor
200
200
to provide metadata.
201
201
Each item in the array corresponds to a decorator.
202
202
203
203
The pattern of creating a constructor and decorating it with metadata is so common that Angular
204
- provides an alternative ES5 convenience class API for it for ES5 Javascript .
204
+ provides an alternative ES5 convenience class API for it for ES5 JavaScript .
205
205
This API lets us define everything in a single expression.
206
206
207
207
With this API we first call the `ng.core.Component` function, followed by a chained `Class`
@@ -225,10 +225,10 @@ a(id="class-metadata")
225
225
component
226
226
` ,`
227
227
Typescript,
228
- ES6 Javascript with decorators,
229
- ES6 Javascript ,
230
- ES5 Javascript ,
231
- ES5 Javascript with Class API
228
+ ES6 JavaScript with decorators,
229
+ ES6 JavaScript ,
230
+ ES5 JavaScript ,
231
+ ES5 JavaScript with Class API
232
232
` )
233
233
234
234
:marked
@@ -251,9 +251,9 @@ a(id="class-metadata")
251
251
` ,`
252
252
` ,`
253
253
Typescript,
254
- ES6 Javascript with decorators,
255
- ES6 Javascript ,
256
- ES5 Javascript
254
+ ES6 JavaScript with decorators,
255
+ ES6 JavaScript ,
256
+ ES5 JavaScript
257
257
` )
258
258
259
259
a( id ="property-metadata" )
@@ -286,9 +286,9 @@ a(id="property-metadata")
286
286
` ,`
287
287
` ,`
288
288
Typescript,
289
- ES6 Javascript with decorators,
290
- ES6 Javascript ,
291
- ES5 Javascript
289
+ ES6 JavaScript with decorators,
290
+ ES6 JavaScript ,
291
+ ES5 JavaScript
292
292
` )
293
293
294
294
.l-main-section
@@ -320,10 +320,10 @@ a(id="property-metadata")
320
320
` ,`
321
321
` ,`
322
322
Typescript,
323
- ES6 Javascript with decorators,
324
- ES6 Javascript ,
325
- ES5 Javascript ,
326
- ES5 Javascript with Class API
323
+ ES6 JavaScript with decorators,
324
+ ES6 JavaScript ,
325
+ ES5 JavaScript ,
326
+ ES5 JavaScript with Class API
327
327
` )
328
328
329
329
:marked
@@ -351,10 +351,10 @@ a(id="property-metadata")
351
351
ctor
352
352
` ,`
353
353
Typescript,
354
- ES6 Javascript with decorators,
355
- ES6 Javascript ,
356
- ES5 Javascript ,
357
- ES5 Javascript with Class API
354
+ ES6 JavaScript with decorators,
355
+ ES6 JavaScript ,
356
+ ES5 JavaScript ,
357
+ ES5 JavaScript with Class API
358
358
` )
359
359
360
360
:marked
@@ -366,9 +366,9 @@ a(id="property-metadata")
366
366
inject content child queries with [`@ContentChild`](../api/core/index/ContentChild-decorator.html)
367
367
and inject view child queries with [`@ViewChild`](../api/core/index/ViewChild-decorator.html)).
368
368
369
- In ES6 Javascript we just add the extra decorators to the nested injection parameters array.
369
+ In ES6 JavaScript we just add the extra decorators to the nested injection parameters array.
370
370
371
- To achieve the same effect in ES5 JavaScript, use the a nested array with the constructor
371
+ To achieve the same effect in ES5 JavaScript, use a nested array with the constructor
372
372
array notation in which the injection information precedes the constructor function itself.
373
373
374
374
We can apply other additional parameter decorators such as
@@ -384,9 +384,9 @@ a(id="property-metadata")
384
384
` ,`
385
385
` ,`
386
386
Typescript,
387
- ES6 Javascript with decorators,
388
- ES6 Javascript ,
389
- ES5 Javascript
387
+ ES6 JavaScript with decorators,
388
+ ES6 JavaScript ,
389
+ ES5 JavaScript
390
390
` )
391
391
392
392
a( id ="host-query-metadata" )
@@ -420,9 +420,9 @@ a(id="host-query-metadata")
420
420
` ,`
421
421
` ,`
422
422
Typescript,
423
- ES6 Javascript with decorators,
424
- ES6 Javascript ,
425
- ES5 Javascript
423
+ ES6 JavaScript with decorators,
424
+ ES6 JavaScript ,
425
+ ES5 JavaScript
426
426
` )
427
427
.alert.is-helpful
428
428
:marked
@@ -440,7 +440,7 @@ a(id="host-query-metadata")
440
440
allow a component to query instances of other components that are used in
441
441
its view.
442
442
443
- In ES5/6 Javascript we access a component's view children by adding a `queries` attribute to
443
+ In ES5/6 JavaScript we access a component's view children by adding a `queries` attribute to
444
444
the component metadata. It should be an object where:
445
445
446
446
* Each key is the name of a component property that will hold the view children
@@ -458,9 +458,9 @@ a(id="host-query-metadata")
458
458
view
459
459
` ,`
460
460
Typescript,
461
- ES6 Javascript with decorators,
462
- ES6 Javascript ,
463
- ES5 Javascript
461
+ ES6 JavaScript with decorators,
462
+ ES6 JavaScript ,
463
+ ES5 JavaScript
464
464
` )
465
465
466
466
:marked
@@ -484,7 +484,7 @@ a(id="host-query-metadata")
484
484
content
485
485
` ,`
486
486
Typescript,
487
- ES6 Javascript with decorators,
488
- ES6 Javascript ,
489
- ES5 Javascript
487
+ ES6 JavaScript with decorators,
488
+ ES6 JavaScript ,
489
+ ES5 JavaScript
490
490
` )
0 commit comments