var App = angular.module("todo", ["LocalStorageModule"]);
App.controller("TodoCtrl", function ($scope, localStorageService) {
$scope.init = function () {
$scope.newTodo = {};
$scope.todos = [];
if (!localStorageService.get("todoList")) {
$scope.todos = [
{ Name:"Make A New Pen", isDone:true},
{ Name: "Pay Phone Bill", isDone: false },
{ Name: "Fix App", isDone: true },
{ Name: "Food Shopping", isDone: false },
{ Name: "Play with Cat", isDone: false }
];
}else{
$scope.todos = localStorageService.get("todoList");
}
};
$scope.getDate = function () {
var today = new Date();
var mm = today.getMonth() + 1;
var dd = today.getDate();
var yyyy = today.getFullYear();
var date = mm + "/" + dd + "/" + yyyy;
return date;
};
$scope.addTodo = function (todoItem) {
todoItem.isDone = false;
$scope.todos.push(todoItem);
$scope.newTodo = {};
};
$scope.deleteTodo = function (index) {