docs: make method arguments optional for event-binding example (#28592)
PR Close #28592
This commit is contained in:
parent
206a21704d
commit
2852beaded
|
@ -11,7 +11,7 @@ export class AppComponent {
|
||||||
currentItem = { name: 'teapot'} ;
|
currentItem = { name: 'teapot'} ;
|
||||||
clickMessage = '';
|
clickMessage = '';
|
||||||
|
|
||||||
onSave(event: KeyboardEvent) {
|
onSave(event?: KeyboardEvent) {
|
||||||
const evtMsg = event ? ' Event target is ' + (<HTMLElement>event.target).textContent : '';
|
const evtMsg = event ? ' Event target is ' + (<HTMLElement>event.target).textContent : '';
|
||||||
alert('Saved.' + evtMsg);
|
alert('Saved.' + evtMsg);
|
||||||
if (event) { event.stopPropagation(); }
|
if (event) { event.stopPropagation(); }
|
||||||
|
@ -21,7 +21,7 @@ export class AppComponent {
|
||||||
alert(`Delete the ${item}.`);
|
alert(`Delete the ${item}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickMe(event: KeyboardEvent) {
|
onClickMe(event?: KeyboardEvent) {
|
||||||
const evtMsg = event ? ' Event target class is ' + (<HTMLElement>event.target).className : '';
|
const evtMsg = event ? ' Event target class is ' + (<HTMLElement>event.target).className : '';
|
||||||
alert('Click me.' + evtMsg);
|
alert('Click me.' + evtMsg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue