Skip to content

Instantly share code, notes, and snippets.

@wescopeland
Created June 16, 2019 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wescopeland/153f6b12b983698c3aecb26aa593e3cc to your computer and use it in GitHub Desktop.
Save wescopeland/153f6b12b983698c3aecb26aa593e3cc to your computer and use it in GitHub Desktop.
presentational-button.component.ts
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
@Component({
selector: 'app-presentational-button',
template: /* html */ `
<button (click)="handleButtonClick()">
{{ buttonLabel || 'Submit' }}
</button>
`
})
export class PresentationalButtonComponent implements OnInit {
@Input() buttonLabel: string;
@Output() press = new EventEmitter<string>();
constructor() {}
ngOnInit() {}
handleButtonClick(): void {
this.press.emit(`${this.buttonLabel || 'Submit'} was pressed!`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment