docs: make method arguments optional in template syntax example (#28592)

PR Close #28592
This commit is contained in:
Brandon 2019-02-07 17:00:55 +00:00 committed by Miško Hevery
parent bfee33edb9
commit 531aa5f8db
1 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ export class AppComponent implements AfterViewInit, OnInit {
currentHero: Hero; currentHero: Hero;
deleteHero(hero: Hero) { deleteHero(hero?: Hero) {
this.alert(`Delete ${hero ? hero.name : 'the hero'}.`); this.alert(`Delete ${hero ? hero.name : 'the hero'}.`);
} }
@ -105,18 +105,18 @@ export class AppComponent implements AfterViewInit, OnInit {
get nullHero(): Hero { return null; } get nullHero(): Hero { return null; }
onClickMe(event: KeyboardEvent) { onClickMe(event?: KeyboardEvent) {
let evtMsg = event ? ' Event target class is ' + (<HTMLElement>event.target).className : ''; let evtMsg = event ? ' Event target class is ' + (<HTMLElement>event.target).className : '';
this.alert('Click me.' + evtMsg); this.alert('Click me.' + evtMsg);
} }
onSave(event: KeyboardEvent) { onSave(event?: KeyboardEvent) {
let evtMsg = event ? ' Event target is ' + (<HTMLElement>event.target).textContent : ''; let evtMsg = event ? ' Event target is ' + (<HTMLElement>event.target).textContent : '';
this.alert('Saved.' + evtMsg); this.alert('Saved.' + evtMsg);
if (event) { event.stopPropagation(); } if (event) { event.stopPropagation(); }
} }
onSubmit() {/* referenced but not used */} onSubmit(data: any) {/* referenced but not used */}
product = { product = {
name: 'frimfram', name: 'frimfram',