Angularjs 角度和将数据过帐到表单

Angularjs 角度和将数据过帐到表单,angularjs,angularjs-forms,Angularjs,Angularjs Forms,我是新的编程整体,这是我第一次尝试使用角度,所以请考虑到这一点,当你回答。有人建议我尝试使用Angular构建一个待办事项列表,以了解有关java脚本的更多信息,我一直在研究如何在单击“添加任务”按钮时将数据(待办事项)发布到表单上。表单会重置,因此我知道按钮正在“工作”,但我的项目不会呈现。如果有人能帮助我,我将不胜感激 下面是我的代码的相关部分。提前感谢您的帮助 html: <form ng-submit= "addTodo()" class= "list-group-item"

我是新的编程整体,这是我第一次尝试使用角度,所以请考虑到这一点,当你回答。有人建议我尝试使用Angular构建一个待办事项列表,以了解有关java脚本的更多信息,我一直在研究如何在单击“添加任务”按钮时将数据(待办事项)发布到表单上。表单会重置,因此我知道按钮正在“工作”,但我的项目不会呈现。如果有人能帮助我,我将不胜感激

下面是我的代码的相关部分。提前感谢您的帮助

html:

   <form ng-submit= "addTodo()" class= "list-group-item">
     <input type= "text" placeholder= "Add your task here" ng-model= "newTodo"/>
      <select ng-model= "todoPriority">
       <option value= "normal">Low</option>
       <option value= "normal">Medium</option>
       <option value= "normal">High</option>
     </select>
    <button ng-click= "addTodo()">Add Task to List</button>
  </form>
        (function(){
  var app = angular.module('Todo-app', []);
    app.controller('TodoCtrl', function($scope){
        $scope.todos= [];

        $scope.todoPriority= 'normal';

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


        $scope.getTotal= function(){
      return $scope.todos.length;
    };

   $scope.removeTodo= function(start){

      $scope.todos.splice(start, 1);
    };

    $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);
    };
 });

});