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

End*_*050 16 javascript jquery internet-explorer angularjs

我有一个Angular JS v1.2.5表单,在IE11中不起作用.它在Firefox,Chrome,Safari中运行良好.我的表单在占位符属性中使用带插值的textarea.

  <body ng-controller="MainCtrl">
    <p>Hello {{ name }}!</p>
    <textarea rows="4" placeholder="Description of the {{ name }}"></textarea>
  </body>
Run Code Online (Sandbox Code Playgroud)

如果使用插值指定占位符属性,则会出现以下错误(仅在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)
Run Code Online (Sandbox Code Playgroud)

这是一个在Firefox,Chrome,Safari中运行良好的Plnkr,但不适用于IE11. http://plnkr.co/edit/4cJzxtVSDoL2JMI9nYrS?p=preview

我失去了尝试在Angular.js内部进行调试.我真的很感激任何让我朝着正确方向前进的提示.谢谢.

Ale*_*der 49

我能够使用ng-attr-placeholder指令在IE中正常工作,而不是直接绑定到DOM中的属性.例如:

<textarea ng-attr-placeholder="Description of the {{ name }}"></textarea>
Run Code Online (Sandbox Code Playgroud)

  • 这应该被接受为anwser,不需要额外的代码. (4认同)