English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

AngularJS ng-Directive submit

AngularJS 参考手册

Exemple AngularJS

Exécuter la fonction après le soumission du formulaire:

!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<form ng-submit="myFunc()">
  <input type="text">
  <input type="submit">
</form>
<p>{{myTxt}}</p>
<p>以下示例演示了表单提交后 AngularJS 执行行。</p>
<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
  $scope.myTxt = "你还没有点击提交!";
  $scope.myFunc = function () {
      $scope.myTxt = "你点击了提交!";
  }
});
</script>
</body>
</html>
test see ‹/›

definition and usage

ng-submit The directive is used to execute a specified function after the form is submitted.

syntax

   <form ng-submit="expression"></form>

The <form> element supports this attribute.

parameter value

valuedescription
expressionAfter the form is submitted, a function will be called, or an expression will be executed, and the expression returns the function call.

AngularJS 参考手册