ng-submit用于定义表单提交后的动作
form标签支持该元素
用例:
<div ng-app=“tosubmit” ng-controller=“ctrl”>
<form ng-submit=“afterSubmit”>
<input type=“text”>
<input type=“password”>
<input type=“submit”>
</form>
<script src=“...../angularjs.min.js”></script>
<script>
var subapp = angular.module(“tosubmit”,[]);
subapp.controller(“ctrl”,function($scope){
$scope.aftersubmit=function(){
alert(“提交成功!”);
}
});
</script>
</div>
额外说明:提交表单需要用name属性,根据name发送数据到服务器