{"size": 752, "ext": "js", "max_stars_repo_path": "src/components/todo-form/index.js", "max_stars_repo_name": "muratzorer/ToDo", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/todo-form/index.js", "max_issues_repo_name": "muratzorer/ToDo", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/todo-form/index.js", "max_forks_repo_name": "muratzorer/ToDo", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 16.7111111111, "max_line_length": 53, "alphanum_fraction": 0.5757978723}
var todoForm = {
  controller: todoFormController,
  template: require('./todo-form.html'),
  bindings: {
    mylist: '<',
    onSubmit: '&',
    onSort: '&'
  }
};

function todoFormController() {
  var self = this;

  self.returnTodoStore = function returnTodoStore() {
    return _.map(this.mylist, function(n){return n});
  };

  self.$onInit = function $onInit() {
    self.newTodo = {};
    resetTodo();
  };

  self.submitForm = function submitForm() {
    // Call parent
    self.onSubmit({
      $event: {
        todo: self.newTodo
      }
    });

    resetTodo();
  };

  self.sortList = function sortList() {
      // Call parent
      self.onSort();
  };

  function resetTodo() {
    self.newTodo = {};
  }
}

module.exports = todoForm;
