<commit_before>import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Todo } from '../../../store/todos/todos.interface';

@Component({
	selector: 'todo-form',
	template: `
	<form (ngSubmit)="submit()">
		<input name="text" [(ngModel)]="text">
		<button type="submit">Add todo</button>
	</form>
	<div *ngIf="todos.items.length">
		<button type="button"
			(click)="onTogglelAll.emit($event)">Toggle all todos
		</button>
		<button type="button"
			(click)="onDeleteAll.emit($event)">Delete all todos
		</button>
	</div>
	`
})

export class TodoFormComponent {

	@Input() todos: Array<Todo>;
	@Output() onAdd: EventEmitter<string> = new EventEmitter();
	@Output() onToggleAll: EventEmitter<any> = new EventEmitter();
	@Output() onDeleteAll: EventEmitter<any> = new EventEmitter();

	text: string;

	submit(): void {
		if (!this.text) {
			return;
		}
		this.onAdd.emit(this.text);
		this.text = '';
	}
}<commit_msg>Adds annotations and fixes typo<commit_after>import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Todo } from '../../../store/todos/todos.interface';

@Component({
	selector: 'todo-form',
	template: `
	<form (ngSubmit)="submit()">
		<input name="text" [(ngModel)]="text">
		<button type="submit">Add todo</button>
	</form>
	<div *ngIf="todos.items.length">
		<button type="button"
			(click)="onToggleAll.emit($event)">Toggle all todos
		</button>
		<button type="button"
			(click)="onDeleteAll.emit($event)">Delete all todos
		</button>
	</div>
	`
})

export class TodoFormComponent {

	@Input() todos: Array<Todo>;
	@Output() onAdd: EventEmitter<string> = new EventEmitter();
	@Output() onToggleAll: EventEmitter<any> = new EventEmitter();
	@Output() onDeleteAll: EventEmitter<any> = new EventEmitter();

	text: string;

	/**
	 * Emit submit event and clear input.
	 * @return {void}
	 */
	submit(): void {
		if (!this.text) {
			return;
		}
		this.onAdd.emit(this.text);
		this.text = '';
	}
}
{'fraction_non_alphanumeric': 0.19287531806615776, 'fraction_numerical': 0.0, 'mean_word_length': 4.601139601139601, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3018746', 'n_tokens_mistral': 733, 'n_tokens_neox': 696, 'n_words': 150}