@@ -165,7 +165,7 @@ a(id="class-metadata")
165
165
For example, a component must have a
166
166
[`@Component`](../api/core/index/Component-decorator.html) decorator.
167
167
168
- On ES6 or ES5 Javascript we can instead attach an `annotations` array to a class/constructor
168
+ On ES5/6 Javascript we can instead attach an `annotations` array to a class/constructor
169
169
to provide metadata.
170
170
Each item in the array corresponds to a decorator.
171
171
@@ -177,7 +177,6 @@ a(id="class-metadata")
177
177
method call.
178
178
The argument to `Class` is an object that defines the constructor and the instance methods
179
179
of the component.
180
-
181
180
Similar APIs are also available for other decorators. You can define a directive with
182
181
`ng.core.Directive` or a pipe with `ng.core.Pipe`.
183
182
@@ -210,7 +209,7 @@ a(id="class-metadata")
210
209
`ngOnInit` is defined in the `OnInit` interface.
211
210
212
211
TypeScript interfaces are purely for developer convenience and are not used by Angular at runtime.
213
- This means that in ES6 or ES5 JavaScript code we don't need to substitute anything for interfaces.
212
+ This means that in ES5/6 JavaScript code we don't need to substitute anything for interfaces.
214
213
We can just implement the methods.
215
214
216
215
+ makeTabs(`
@@ -231,46 +230,35 @@ a(id="property-metadata")
231
230
:marked
232
231
## Input and Output Metadata
233
232
234
- - var top= " vertical-align:top"
235
- table( width ="100%" )
236
- col( width ="50%" )
237
- col( width ="50%" )
238
- tr
239
- th TypeScript
240
- th ES5 JavaScript
241
- tr( style =top)
242
- td
243
- :marked
244
- ### Input and Output Decorators
245
-
246
- In TypeScript, property decorators are often used to provide additional metadata
247
- for components and directives.
233
+ ### Input and Output Decorators
248
234
249
- For [inputs and outputs](../guide/template-syntax.html#inputs-outputs),
250
- we use `@Input` and `@Output` property decorators.
251
- They may optionally specify input and output binding names if we want them to be
252
- different from the class property names.
253
-
254
- + makeExample('cb-ts-to-js/ts/app/hero-io.component.ts' )( format ="." )
255
-
256
- .alert.is-helpful
257
- :marked
258
- In TypeScript we can also use the `inputs` and `outputs` array metadata
259
- instead of the `@Input` and `@Output` property decorators.
260
- td
261
- :marked
262
- ### Inputs and Outputs in Component Metadata
263
-
264
- There is no equivalent of a property decorator in ES5 JavaScript. Instead,
265
- we add comparable information to the `Component` (or `Directive`) metadata.
266
-
267
- In this example, we add `inputs` and `outputs` array attributes
268
- containing the input and output property names.
269
- If we need a binding name that is different from the
270
- property itself, we use the `propertyName: bindingName` syntax.
271
-
272
- + makeExample('cb-ts-to-js/js/app/hero-io.component.js' )( format ="." )
235
+ In TypeScript and ES6 with decorators, property decorators are often used to provide additional
236
+ metadata for components and directives.
237
+ For [inputs and outputs](../guide/template-syntax.html#inputs-outputs), we use `@Input` and
238
+ `@Output` property decorators.
239
+ They may optionally specify input and output binding names if we want them to be different
240
+ from the class property names.
273
241
242
+ There is no equivalent of a property decorator in ES5/6 JavaScript.
243
+ Instead, we add comparable information to the `Component` (or `Directive`) metadata.
244
+
245
+ In this example, we add `inputs` and `outputs` array attributes containing the input and
246
+ output property names.
247
+ If we need a binding name that is different from the property itself, we use the
248
+ `propertyName: bindingName` syntax.
249
+
250
+ + makeTabs(`
251
+ cb-ts-to-js/ts/app/hero-io.component.ts,
252
+ cb-ts-to-js/js-es6-decorators/app/hero-io.component.es6,
253
+ cb-ts-to-js/js-es6/app/hero-io.component.es6,
254
+ cb-ts-to-js/js/app/hero-io.component.js
255
+ ` ,`
256
+ ` ,`
257
+ Typescript,
258
+ ES6 Javascript with decorators,
259
+ ES6 Javascript,
260
+ ES5 Javascript
261
+ ` )
274
262
275
263
.l-main-section
276
264
:marked
0 commit comments