You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
Copy file name to clipboardExpand all lines: public/docs/js/latest/cookbook/ts-to-js.jade
+95-85Lines changed: 95 additions & 85 deletions
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ include ../../../../_includes/_util-fns
24
24
25
25
[Dependency Injection](#dependency-injection)
26
26
27
-
[Host and Query Metadata](#other-property-metadata)
27
+
[Host and Query Metadata](#host-query-metadata)
28
28
29
29
**Run and compare the live <live-example name="cb-ts-to-js">TypeScript</live-example> and <live-example name="cb-ts-to-js" lang="js">JavaScript</live-example>
30
30
code shown in this cookbook.**
@@ -358,92 +358,102 @@ a(id="property-metadata")
358
358
ES5 Javascript
359
359
`)
360
360
361
-
a(id="other-property-metadata")
361
+
a(id="host-query-metadata")
362
362
.l-main-section
363
363
:marked
364
364
## Host and Query Metadata
365
365
366
-
- var top="vertical-align:top"
367
-
table(width="100%")
368
-
col(width="50%")
369
-
col(width="50%")
370
-
tr
371
-
th TypeScript
372
-
th ES5 JavaScript
373
-
tr(style=top)
366
+
### Host Decorators
367
+
368
+
In Typescript and ES6 with decorators we can use host property decorators to bind a host
369
+
element to a component or directive.
370
+
The [`@HostBinding`](../api/core/index/HostBinding-interface.html) decorator
371
+
binds host element properties to component data properties.
372
+
The [`@HostListener`](../api/core/index/HostListener-interface.html) decorator binds
373
+
host element events to component event handlers.
374
+
375
+
When using ES5/6 we add a `host` attribute to the component metadata to achieve the
376
+
same effect as `@HostBinding` and `@HostListener`.
377
+
378
+
The `host` value is an object whose properties are host property and listener bindings:
374
379
375
-
td
376
-
:marked
377
-
### Host Decorators
378
-
379
-
We can use host property decorators to bind a host element to a component or directive.
380
-
The [`@HostBinding`](../api/core/index/HostBinding-interface.html) decorator
381
-
binds host element properties to component data properties.
382
-
The [`@HostListener`](../api/core/index/HostListener-interface.html) decorator bimds
0 commit comments