2020-07-30 13:03:21 +03:00
|
|
|
import { Component, HostBinding } from '@angular/core';
|
2020-01-30 14:09:10 -08:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'comp-with-host-binding',
|
|
|
|
template: 'I am a component!',
|
|
|
|
})
|
|
|
|
export class CompWithHostBindingComponent {
|
2020-07-30 13:03:21 +03:00
|
|
|
@HostBinding('class.special')
|
2020-01-30 14:09:10 -08:00
|
|
|
isSpecial = false;
|
2020-07-30 13:03:21 +03:00
|
|
|
|
|
|
|
@HostBinding('style.color')
|
2020-01-30 14:09:10 -08:00
|
|
|
color = 'green';
|
2020-07-30 13:03:21 +03:00
|
|
|
|
2020-09-14 17:12:32 -04:00
|
|
|
// #docregion hostbinding
|
2020-07-30 13:03:21 +03:00
|
|
|
@HostBinding('style.width')
|
2020-01-30 14:09:10 -08:00
|
|
|
width = '200px';
|
2020-09-14 17:12:32 -04:00
|
|
|
// #enddocregion hostbinding
|
|
|
|
|
2020-01-30 14:09:10 -08:00
|
|
|
}
|