在IE10 +,文本区域与占位原因和QUOT AngularJS。无效参数" [英] AngularJS on IE10+ ,textarea with placeholder cause "Invalid argument."
问题描述
我得到的无效参数的使用angularJS,多行文本控件占位符,在IE10 +时。
这只会发生在textarea的节点与关闭< / textarea的方式>
,当我现在关闭textarea的本身不会发生。
这将提高无效参数异常:
< DIV NG-应用>
<输入NG模型=placeholderModel类型=文本/>
< textarea的ID =消息占位符={{placeholderModel}}NG模型=textareaModel>< / textarea的>
< / DIV>
这将没有任何问题的工作:
< DIV NG-应用>
<输入NG模型=placeholderModel类型=文本/>
< textarea的ID =消息占位符={{placeholderModel}}NG模型=textareaModel/>
< / DIV>
运行例子在这里: http://jsfiddle.net/huecc/
这似乎与你绑定到该元素的占位符方式的问题 - 奇怪,我知道
我能得到的一切使用 NG-ATTR占位符指令代替在DOM直接结合到属性
例如,而不是:的
< textarea的占位符={{placeholderModel}}NG模型=textareaModel>< / textarea的>
试试这个:
< textarea的NG-ATTR占位符=placeholderModelNG模型=textareaModel>< / textarea的>
相关: AngularJS 1.2.5脚本文本区域和占位符属性使用IE11 <错误/ p>
I'm getting "Invalid argument" when using angularJS ,TextArea with placeholder, on IE10+.
This will ONLY happen when the textarea node is closed with </textarea>
and will not happen when I close the textarea now on itself.
This will raise the "Invalid argument" exception:
<div ng-app>
<input ng-model="placeholderModel" type="text"/>
<textarea id="message" placeholder="{{placeholderModel}}" ng-model="textareaModel"></textarea>
</div>
This will work with no problems:
<div ng-app>
<input ng-model="placeholderModel" type="text"/>
<textarea id="message" placeholder="{{placeholderModel}}" ng-model="textareaModel"/>
</div>
Running example here: http://jsfiddle.net/huecc/
This seems to be an issue with the way you're binding to the element's placeholder - strange, I know.
I was able to get everything working correctly in IE using the ng-attr-placeholder directive instead of binding directly to the attribute in the DOM.
For example, instead of:
<textarea placeholder="{{placeholderModel}}" ng-model="textareaModel"></textarea>
Try this:
<textarea ng-attr-placeholder="placeholderModel" ng-model="textareaModel"></textarea>
Related: AngularJS v1.2.5 script error with textarea and placeholder attribute using IE11
这篇关于在IE10 +,文本区域与占位原因和QUOT AngularJS。无效参数&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!