Angular: If ngModel is used within a form tag, either the name attribute must be set or the form control must be defined as ‘standalone’ in ngModelOptions.
在Angular中,动态生成的Html控件,如果没有name属性并且在ts中要操作Model的内容。就会引发如题的错误。
解决方案两个:
- 加上name的属性
- 设置ngModelOptions
[ngModelOptions]="{standalone: true}"
Angular: If ngModel is used within a form tag, either the name attribute must be set or the form control must be defined as ‘standalone’ in ngModelOptions.的更多相关文章
- ASP.NET Core MVC – Form Tag Helpers
ASP.NET Core Tag Helpers系列目录 ASP.NET Core MVC Tag Helpers 介绍 ASP.NET Core MVC – Caching Tag Helpers ...
- angular中ng-model,返回数据,拆分数据,展示,名称相同,重新赋值会有冲突
本问题出在angular,1.X版本,我用的是1.5的版本: 问题原因: <input type="number" ng-mode="a" /> & ...
- [Angular 2] ng-model and ng-for with Select and Option elements
You can use Select and Option elements in combination with ng-for and ng-model to create mini-forms ...
- Angular中ngModel的$render的详解
在我开始着手ngModel的领域时候,有一个问题很令我纠结,那就是$render()到底是做什么的呢?查了很多资料都只是简单的描述一下,这就令我很纠结了,终于在一个阳光明媚的晚上,我终于解决了这个大问 ...
- angular select2 ng-model 取值 ng-change调用方法
页面: 引入文件 '/select2.css', '/select2-bootstrap.css', '/select2.min.js', '/ui-select2.js' html: <div ...
- Angular2 报错 ERROR Error: If ngModel is used within a form tag
今天写textarea的双向数据绑定报错,错误如图: 错误代码如下: <div class="form-group"> <textarea id="&q ...
- Angular JS ng-model对<select>标签无效的情况
使用场景一: <select ng-if="item.award_type==1" id="award{{$index+1}}" name="X ...
- error:Unterminated <form:form tag
问题:标签不对称 解决:<form:form></form> 改成 <form:form> </form:form> 虽然又是自动补全带来的bug,但还 ...
- form(form基础、标签渲染、错误显示 重置信息、form属性、局部钩子、全局钩子)
form基础 Django中的Form使用时一般有两种功能: 1.生成html标签 2.验证输入内容 要想使用django提供的form,要在views里导入form模块 from django im ...
随机推荐
- hdu1576 扩展欧几里德 A/B
A/B Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- Pipenv的简单使用
安装 $ pip install pipenv 安装虚拟环境 pipenv install 新建一个准备当环境的文件夹pipenvtest,并cd进入该文件夹: - pipenv --three 会使 ...
- 【LeetCode】34-在排序数组中查找元素的第一个和最后一个位置
题目描述 给定一个按照升序排列的整数数组 nums,和一个目标值 target.找出给定目标值在数组中的开始位置和结束位置. 你的算法时间复杂度必须是 O(log n) 级别. 如果数组中不存在目标值 ...
- eclipse中离线安装activit插件
离线安装activiti教程: 1.先下载压缩包和jar包 链接:https://pan.baidu.com/s/1hSToZt_4A262rUxc8KToCw 密码:j5r1 2.将下载好的jars ...
- print.js继承原有样式
npm install --save print-js import Print from 'print-js' 调用print.js插件 Print({ printable: 'printJS-fo ...
- Mysql使用SSL连接
最近项目中用到了SSL连接,记录一下,环境为windows10,Mysql版本为5.6 查看是否支持 SSL 首先在 MySQL 上执行如下命令, 查询是否 MySQL 支持 SSL: mysql&g ...
- 金融风控100道面试题:传统银行开发转行互金top3公司并年薪40多万
知乎上有一个50万人看过的问题“为什么自学Python看不进去?”,其实原因很简单,大家缺乏能动手实战的机会. 知识要是死记硬背记在在脑海中,用不了多久就会忘记,只用依靠实战才能让知识落地. 小七这次 ...
- eclipse wifi 连接手机
参考:http://blog.csdn.net/onlyonecoder/article/details/9121397 首先打开手机的wifi设置,使其连接到网络.然后,需要在手机上对adb连接端口 ...
- 【第十篇】easyui-datagrid排序 (转)
本文体验datagrid的排序. □ 思路 当点击datagrid的标题,视图传递给Controller的Form Data类似这样:page=1&rows=10&sort=Custo ...
- style属性css与javascript对照表
有时候会用javascript来控制标签的style,但js的style属性写法跟css有点不一样,通常是一个单词的写法不变,单词-单词属性会去掉“-”,再把第二个单词的首字母大写,估计是为了与减法运 ...