<commit_before>library untitled34.component.todo_cmp;

import 'dart:html' show InputElement;

import 'package:angular2/angular2.dart';
import 'package:todomvc/services/todo_store.dart' show Todo, TodoStore;

@Component(selector: 'todo-cmp', viewBindings: const [TodoStore])
@View(templateUrl: 'todo_cmp.html', directives: const [CORE_DIRECTIVES])
class TodoComponent {
  TodoStore todoStore;

  TodoComponent(this.todoStore);

  addTodo(InputElement input) {
    if (input.value.trim().isNotEmpty) {
      todoStore.add(input.value);
      input.value = '';
    }
  }

  void cancelEditing(Todo todo) {
    todo.editing = false;
  }

  void saveEditing(Todo todo, String title) {
    todo.editing = false;

    if (title.isEmpty) {
      todoStore.remove(todo.uid);
    } else {
      todo.title = title;
    }
  }
}<commit_msg>trying to implement router<commit_after>library untitled34.component.todo_cmp;

import 'dart:html' show InputElement;

import 'package:angular2/angular2.dart';
import 'package:todomvc/services/todo_store.dart' show Todo, TodoStore;
import 'package:angular2/router.dart';

@Component(selector: 'todo-cmp', viewBindings: const [TodoStore])
@View(templateUrl: 'todo_cmp.html', directives: const [CORE_DIRECTIVES])
class TodoComponent {
  TodoStore todoStore;

  Router router;

  TodoComponent(this.todoStore, this.router) {
    router.subscribe((value) {
      print("Route changed to: $value");
      todoStore.filter = value;
    });
  }


  addTodo(InputElement input) {
    if (input.value.trim().isNotEmpty) {
      todoStore.add(input.value);
      input.value = '';
    }
  }

  void cancelEditing(Todo todo) {
    todo.editing = false;
  }

  void saveEditing(Todo todo, String title) {
    todo.editing = false;

    if (title.isEmpty) {
      todoStore.remove(todo.uid);
    } else {
      todo.title = title;
    }
  }
}
{'fraction_non_alphanumeric': 0.12924071082390953, 'fraction_numerical': 0.004846526655896607, 'mean_word_length': 3.788659793814433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5297022', 'n_tokens_mistral': 660, 'n_tokens_neox': 650, 'n_words': 119}