Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Replace next() with emit() for EventEmitter<T> for consistency. #2812

Merged
merged 1 commit into from
Nov 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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>) {}

Expand All @@ -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
2 changes: 1 addition & 1 deletion public/docs/_examples/homepage-todo/ts/app/todo_form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
}
Expand Down
4 changes: 2 additions & 2 deletions public/docs/_examples/testing/ts/app/bag/bag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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