Replace next() with emit() for EventEmitter<T> (#2812)
This commit is contained in:
parent
199d2096d6
commit
fea03ea097
@ -21,8 +21,8 @@ import { Hero } from './hero';
|
||||
})
|
||||
|
||||
export class HeroEditorComponent {
|
||||
@Output() canceled = new EventEmitter();
|
||||
@Output() saved = new EventEmitter();
|
||||
@Output() canceled = new EventEmitter<Hero>();
|
||||
@Output() saved = new EventEmitter<Hero>();
|
||||
|
||||
constructor(private restoreService: RestoreService<Hero>) {}
|
||||
|
||||
@ -36,12 +36,12 @@ export class HeroEditorComponent {
|
||||
}
|
||||
|
||||
onSaved () {
|
||||
this.saved.next(this.restoreService.getItem());
|
||||
this.saved.emit(this.restoreService.getItem());
|
||||
}
|
||||
|
||||
onCanceled () {
|
||||
this.hero = this.restoreService.restoreItem();
|
||||
this.canceled.next(this.hero);
|
||||
this.canceled.emit(this.hero);
|
||||
}
|
||||
}
|
||||
// #enddocregion
|
||||
|
@ -17,7 +17,7 @@ export class TodoFormComponent {
|
||||
|
||||
addTodo() {
|
||||
if (this.task) {
|
||||
this.newTask.next({text: this.task, done: false});
|
||||
this.newTask.emit({text: this.task, done: false});
|
||||
}
|
||||
this.task = '';
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ export class InputComponent {
|
||||
// selector: 'input[value]',
|
||||
// host: {
|
||||
// '[value]': 'value',
|
||||
// '(input)': 'valueChange.next($event.target.value)'
|
||||
// '(input)': 'valueChange.emit($event.target.value)'
|
||||
// },
|
||||
// inputs: ['value'],
|
||||
// outputs: ['valueChange']
|
||||
@ -173,7 +173,7 @@ export class InputValueBinderDirective {
|
||||
valueChange: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
@HostListener('input', ['$event.target.value'])
|
||||
onInput(value: any) { this.valueChange.next(value); }
|
||||
onInput(value: any) { this.valueChange.emit(value); }
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -13,6 +13,6 @@ import { Hero } from '../model';
|
||||
export class DashboardHeroComponent {
|
||||
@Input() hero: Hero;
|
||||
@Output() selected = new EventEmitter<Hero>();
|
||||
click() { this.selected.next(this.hero); }
|
||||
click() { this.selected.emit(this.hero); }
|
||||
}
|
||||
// #enddocregion component
|
||||
|
Loading…
x
Reference in New Issue
Block a user