Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset='UTF-8'>
<title>JS BIN</title>
  Get free likes on facebook
  
    
  <!--bootstrap-->
  
  <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
   
  
</head>
  
<body >
 
  <fieldset disabled>
   <input/>   
  </fieldset>
  
  
  
  </body>
</html>
 
function TodoCtrl($scope, $http){
 
  
 
  
  $scope.todos= [
    
    ];
  
  //get number of todos
   $scope.getTotal = function () {
    return $scope.todos.length;
  };
  
  //add todo
  $scope.addTodo = function (){
    $http.get("http://todo.ceresti.com:8080/task/add");
    
    var newItem = {
      done:false,
      text: $scope.todoText
    };
    
    $scope.todos.push(newItem);
    $scope.todoText='';
    
  };
  
  //remove todo
  $scope.removeTodo = function(start){
    $scope.todos.splice(start,1);
    
  };
  
  
  
  //move todo
  $scope.move = function(index,direction){
    if(direction==='up'){
      if(index===0){
        return;
      }
      index=index-1;
    }
    if(direction==='down'){
       if(index === $scope.todos.length-1){
      return;
    }
      
    }
   
    var todo=$scope.todos[index];
    $scope.todos.splice(index + 2 , 0 , todo);
    $scope.todos.splice(index,1);
  };
  
 
 
  
  
  
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
petrkoulapro
0viewers