mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
docs: fix hostbinding. (#63509)
HostBindings only work on properties and getters. Not methods. fixes #57909 PR Close #63509
This commit is contained in:
committed by
Jessica Janiuk
parent
7dde1951d0
commit
0495254143
@@ -67,7 +67,7 @@ export class CustomSlider {
|
||||
You can alternatively bind to the host element by applying the `@HostBinding` and `@HostListener`
|
||||
decorator to class members.
|
||||
|
||||
`@HostBinding` lets you bind host properties and attributes to properties and methods:
|
||||
`@HostBinding` lets you bind host properties and attributes to properties and getters:
|
||||
|
||||
```angular-ts
|
||||
@Component({
|
||||
@@ -78,7 +78,7 @@ export class CustomSlider {
|
||||
value: number = 0;
|
||||
|
||||
@HostBinding('tabIndex')
|
||||
getTabIndex() {
|
||||
get tabIndex() {
|
||||
return this.disabled ? -1 : 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user