小编典典

使用IE11的textarea和占位符属性的AngularJS v1.2.5脚本错误

angularjs

我有一个Angular JS
v1.2.5表单,该表单在IE11中不起作用。它可以在Firefox,Chrome,Safari中正常运行。我的表单使用占位符属性内有插值的文本区域。

  <body ng-controller="MainCtrl">
    <p>Hello {{ name }}!</p>
    <textarea rows="4" placeholder="Description of the {{ name }}"></textarea>
  </body>

如果使用插值指定占位符属性,则会出现以下错误(仅在IE中)。

Error: Invalid argument.
   at interpolateFnWatchAction (https://localhost:44300/Scripts/angular.js:6410:15)
   at $digest (https://localhost:44300/Scripts/angular.js:11581:23)
   at $apply (https://localhost:44300/Scripts/angular.js:11832:13)
   at done (https://localhost:44300/Scripts/angular.js:7774:34)
   at completeRequest (https://localhost:44300/Scripts/angular.js:7947:7)
   at onreadystatechange (https://localhost:44300/Scripts/angular.js:7903:11)

这是一个可在Firefox,Chrome,Safari和IE11中正常运行的Plnkr。
http://plnkr.co/edit/4cJzxtVSSL2JMI9nYrS?p=preview

我迷失在Angular.js本身中进行调试的尝试。我非常感谢您为我设定正确方向的任何提示。谢谢。


阅读 288

收藏
2020-07-04

共1个答案

小编典典

我可以使用ng-attr-placeholder指令使所有内容在IE中正常工作,而不是直接绑定到DOM中的属性。例如:

<textarea ng-attr-placeholder="Description of the {{ name }}"></textarea>
2020-07-04