需要没有角度形式的输入标签
require input tag without form in angular?
我是 angularJS 的新手。我有 6 个没有表单的输入标签。使用单击按钮。我想提出要求;
这是代码:
<td><input class="form-control" ng-model="contact.tradeMark" required="string" placeholder="Trade Mark" ></td>
<td><input class="form-control" ng-model="contact.applicationNo" placeholder="Application No"></td>
<td><input class="form-control" ng-model="contact.class" placeholder="Class"></td>
<td><input class="form-control" ng-model="contact.status" placeholder="Status"></td>
<td><input class="form-control" ng-model="contact.client" placeholder="Client"></td>
<td><input class="form-control" ng-model="contact.applicant" placeholder="Applicant"></td>
<td><input class="form-control" ng-model="contact.remark" placeholder="Remark"></td>
<td><button class="btn btn-primary" ng-click="addContact()">Add Contact</button></td>
<td><button class="btn btn-info" ng-click="update()">Update</button> <button class="btn btn-info" ng-click="deselect()">Clear</button></td>
提前致谢
有一些方法可以在input
字段中添加required
属性:
-
直接添加
required
属性 -- 这是原始的 HTML 方式
法典:
<input class="form-control" ng-model="contact.tradeMark" required placeholder="Trade Mark" />
在字段中添加
ng-required="true/false"
属性 - 这是AngularJS的方式。
法典:
<input class="form-control" ng-model="contact.tradeMark" ng-required="true" placeholder="Trade Mark" />
添加
ng-required="<some_boolean_condition>"
.
法典:
<input class="form-control" ng-model="contact.tradeMark" ng-required="isRequired" placeholder="Trade Mark" />
其中isRequired
是绑定在view
和controller
之间的model
。
更新:
参考链接: 这里
相关文章:
- 如何使用 JavaScriptJQuery 将隐藏输入标签的值与选择标签的选定选项的值进行设置
- 安卓键盘未打开绑定到触摸启动的输入标签
- 第二个输入标签-如何添加
- 使用 javascript 设置输入标签的值
- 使用 JS 从输入标签中获取多个值
- 数据绑定在带有输入标签的 AngularJS 中不起作用
- 如何单独对输入标签应用样式
- 输入标签从不显示非数字单词的面
- 如何使用 Cookie 将信息保存在输入标签中
- 使用 PURE JS 基于输入标签添加占位符属性 - 没有 jQuery
- 如何查找输入标签中的字符数
- 上下文菜单 JavaScript 无法获取所选文本,如果文本是输入标签/文本框
- ng-bind 用作文本区域的指令,但不是输入标签
- 输入标签上 7 天后的日期
- 为什么新创建的输入标签不会保留在页面上
- 表单:输入标签抛出错误弹簧 MVC
- 向隐藏的输入标签添加值并提交到表单
- 使用纯 JavaScript 从输入标签范围修剪小数
- 使用 POST 方法从后端的 HTML 访问输入标签值
- 如何在 JavaScript 中获取文件路径表单输入标签