Javascript ng submit的默认行为是什么?

Javascript ng submit的默认行为是什么?,javascript,angularjs,Javascript,Angularjs,我刚接触AngularJS,现在正在学习。让我感到困惑的是index.html中以下代码中的ng submit的行为: <form id="todo-form" ng-submit="addTodo()"> <input id="new-todo" placeholder="What needs to be done?" ng-model="newTodo" autofocus> </form> 正如您所看到的,没有任何地方显示事件ng submi

我刚接触AngularJS,现在正在学习。让我感到困惑的是index.html中以下代码中的
ng submit
的行为:

<form id="todo-form" ng-submit="addTodo()">
    <input id="new-todo" placeholder="What needs to be done?" ng-model="newTodo" autofocus>
</form> 
正如您所看到的,没有任何地方显示事件
ng submit
应该对应于什么。我猜
ng submit
是用来处理
input
字段的
enter
事件的。但是,我在网上找不到相关信息。那么,
ng submit
的默认行为是什么?也就是说,我想知道在各种情况下,哪些事件对应于“提交”。在这个特定的示例中,“提交”是否表示输入字段的输入


非常感谢。

这是写在文档顶部的链接:

启用将角度表达式绑定到Submit事件

------------更新-----------------

在下面的评论中,您认为:

单击提交按钮时发生onsubmit事件

这不准确。

首先,让我们确定
ngSubmit
指令引发的事件。
angular scenario.js
中,有以下代码:

var ngSubmitDirective = ngDirective(function(scope, element, attrs) {
  element.bind('submit', function() {
    scope.$apply(attrs.ngSubmit);
  });
});
此外,如果您参考了规范,关于表单提交(因此
submit
event):

当表单中只有一个单行文本输入字段时 用户代理应接受在该字段中输入作为提交请求 表格

此外,根据Angular的代码,第15527行(取决于当前版本):


单击提交按钮时发生onsubmit事件。但在本例中,只有一个输入文本字段。
输入文本如何等于提交?这在某种web标准中是正式规定的吗?答案很好!这正是我要找的。
var ngSubmitDirective = ngDirective(function(scope, element, attrs) {
  element.bind('submit', function() {
    scope.$apply(attrs.ngSubmit);
  });
});
* To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}
 * or {@link ng.directive:ngClick ngClick} directives.
 * This is because of the following form submission rules in the HTML specification:
 *
 * - If a form has only one input field then hitting enter in this field triggers form submit
 * (`ngSubmit`)
 * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter
 * doesn't trigger submit
 * - if a form has one or more input fields and one or more buttons or input[type=submit] then
 * hitting enter in any of the input fields will trigger the click handler on the *first* button or
 * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)