angular-docs-cn/public/docs/_examples/user-input/ts/app/click-me.component.ts

25 lines
547 B
TypeScript

/* FOR DOCS ... MUST MATCH ClickMeComponent template
// #docregion click-me-button
<button (click)="onClickMe()">Click me!</button>
// #enddocregion click-me-button
*/
// #docregion
import { Component } from '@angular/core';
// #docregion click-me-component
@Component({
selector: 'click-me',
template: `
<button (click)="onClickMe()">Click me!</button>
{{clickMessage}}`
})
export class ClickMeComponent {
clickMessage = '';
onClickMe() {
this.clickMessage = 'You are my hero!';
}
}
// #enddocregion click-me-component