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

25 lines
543 B
TypeScript
Raw Normal View History

/* FOR DOCS ... MUST MATCH ClickMeComponent template
// #docregion click-me-button
<button (click)="onClickMe()">Click me!</button>
// #enddocregion click-me-button
*/
// #docregion
import {Component} from 'angular2/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