import { Component } from '@angular/core';
// #docregion
@Component({
selector: 'hero-host-meta',
template: `
Hero Host in Metadata
Heading clicks: {{clicks}}
`,
host: {
// HostBindings to the element
'[title]': 'title',
'[class.heading]': 'headingClass',
// HostListeners on the entire element
'(click)': 'clicked()',
'(mouseenter)': 'enter($event)',
'(mouseleave)': 'leave($event)'
},
// Styles within (but excluding) the element
styles: ['.active {background-color: coral;}']
})
export class HeroHostMetaComponent {
title = 'Hero Host in Metadata Tooltip';
headingClass = true;
active = false;
clicks = 0;
clicked() {
this.clicks += 1;
}
enter(event: Event) {
this.active = true;
this.headingClass = false;
}
leave(event: Event) {
this.active = false;
this.headingClass = true;
}
}
// #enddocregion