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