docs: make method arguments optional for event-binding example (#28592)

PR Close #28592
This commit is contained in:
Brandon 2019-02-07 16:52:29 +00:00 committed by Miško Hevery
parent 206a21704d
commit 2852beaded
1 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ export class AppComponent {
currentItem = { name: 'teapot'} ;
clickMessage = '';
onSave(event: KeyboardEvent) {
onSave(event?: KeyboardEvent) {
const evtMsg = event ? ' Event target is ' + (<HTMLElement>event.target).textContent : '';
alert('Saved.' + evtMsg);
if (event) { event.stopPropagation(); }
@ -21,7 +21,7 @@ export class AppComponent {
alert(`Delete the ${item}.`);
}
onClickMe(event: KeyboardEvent) {
onClickMe(event?: KeyboardEvent) {
const evtMsg = event ? ' Event target class is ' + (<HTMLElement>event.target).className : '';
alert('Click me.' + evtMsg);
}