angularjs ng-submit
来源:互联网 发布:zbrush mac 中文版 编辑:程序博客网 时间:2024/06/14 20:42
介绍
http://docs.ngnice.com/api/ng/directive/ngSubmit
定义和用法
ng-submit 指令用于在表单提交后执行指定函数。
语法
<form ng-submit="expression"></form><form> 元素支持该属性。
参数值
expression 表单提交后函数将被调用,或者一个表达式将被执行,表达式返回函数调用。
例子
<!doctype html><html lang="en"><head> <meta charset="UTF-8"> <title>Example - example-example32-production</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js"></script></head><body ng-app=""> <script> function Ctrl($scope) { $scope.list = []; $scope.text = 'hello'; $scope.submit = function() { if ($scope.text) { $scope.list.push(this.text); $scope.text = ''; } }; } </script> <form ng-submit="submit()" ng-controller="Ctrl"> Enter text and hit enter: <input type="text" ng-model="text"/> <input type="submit" /> <pre>list={{list}}</pre> </form></body></html>
当执行回车或点击提交input时,都会执行submit()方法,向list中添加数据。
阅读全文
0 0
- angularjs ng-submit
- ng-submit
- angularjs ng-show ng-hidden
- AngularJS ng-click bug
- AngularJS ng-include
- angularjs ng-repeat
- AngularJS ng-class
- Angularjs ng-options用法
- angularjs ng-repeat
- AngularJS ng-class用法
- AngularJS ng-model directive
- AngularJS ng-cloak 指令
- AngularJs----ng-class
- AngularJS ng-model 指令
- AngularJs ng-options
- AngularJS ng-model 指令
- AngularJS ng-class用法
- Angularjs中的ng-repeat
- Kendo UI Grid
- 关于一个应用进程打开另外一个应用进程的TASK和PROCESS 说明
- android监听软键盘隐藏
- python学习 原始字符串操作符 print
- MFC 双缓冲多重绘图去除闪烁的万能函数模板
- angularjs ng-submit
- oracle数据库表和表数据以及事物,视图
- 软考信息安全工程师备考指南
- C#中OpenFileDialog和FolderBrowserDialog使用
- 读孔令贤有感
- 免备案主机推荐
- verify the embedded binary target's code sign settings match the parent app's
- 使用git工具提交上传代码到GitHub上或者远程仓库
- Go实战--golang中生成读取二维码(skip2/go-qrcode和boombuler/barcode)