<!DOCTYPE html>
<html>

  <head>
    <link rel="stylesheet" href="style.css">
    
    
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.4/angular.min.js"></script>
    <script src="script.js"></script>

  </head>

  <body>

    <div ng-app="todoApp">
  <h2>Todo List</h2>
  <div ng-controller="TodoController">
  
    <div ng-repeat="todo in todos">
      <span>{{todo.text}}</span>
      <input type="text" ng-model="todo.text"/>
      <input type="checkbox"/>
    </div>
  
  <h2>By Table</h2>  
    
    <table>
       <tr ng-repeat="todo in todos">
            <td ng-click="activePost(todo)" class="title">{{todo.text}}</td>
            <td><input type="text" ng-model="todo.text"/></td>\
            <td>{{todo.text}}</td>
       </tr>
    </table>
    
  </div>
</div>

  </body>

</html>
angular.module('todoApp', [])
  .controller('TodoController', ['$scope', function($scope) {
    $scope.todos = [
      {text:'learn angular', done:true},
      {text:'build an angular app', done:false},
      {text:'added by vijay', done:false}
      ];

    $scope.addTodo = function() {
      $scope.todos.push({text:$scope.todoText, done:false});
      $scope.todoText = '';
    };

    $scope.remaining = function() {
      var count = 0;
      angular.forEach($scope.todos, function(todo) {
        count += todo.done ? 0 : 1;
      });
      return count;
    };

    $scope.archive = function() {
      var oldTodos = $scope.todos;
      $scope.todos = [];
      angular.forEach(oldTodos, function(todo) {
        if (!todo.done) $scope.todos.push(todo);
      });
    };
  }]);

/* Styles go here */