AngularJS ng-submit 指令

AngularJS 教程 · 2019-04-02 08:16:48

AngularJS 实例

表单提交后执行函数:

<body ng-app="myApp" ng-controller="myCtrl">

<form ng-submit="myFunc()">
    <input type="text">
    <input type="submit">
</form>

<p>{{myTxt}}</p>

<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
    $scope.myTxt = "你还没有点击提交!";
    $scope.myFunc = function () {
        $scope.myTxt = "你点击了提交!";
    }
});
</script>
</body>

定义和用法

ng-submit 指令用于在表单提交后执行指定函数。

语法

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

<form> 元素支持该属性。

参数值

描述
expression 表单提交后函数将被调用,或者一个表达式将被执行,表达式返回函数调用。

点击查看所有 AngularJS 教程 文章: https://www.codercto.com/courses/l/36.html

查看所有标签

Computational Advertising

Computational Advertising

by Kushal Dave、Vasudeva Varma / Now Publishers Inc / 2014

Computational Advertising (CA), popularly known as online advertising or Web advertising, refers to finding the most relevant ads matching a particular context on the Web. The context depends on the t......一起来看看 《Computational Advertising》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具