【问题标题】:ng-bind-html inside input text does not bind输入文本中的 ng-bind-html 不绑定
【发布时间】:2014-01-13 18:02:56
【问题描述】:

ng-repeat 中,以下代码不起作用:

<input type="text" ng-bind-html="row.value" />

以下是:

<span ng-bind-html="row.value"></span>

我猜ng-bind-html 无法绑定到input 元素?

ng-bind-html 也确实将元素与模型绑定(此处为row.value

【问题讨论】:

    标签: angularjs ng-bind-html


    【解决方案1】:

    那是因为input 元素不能有innerHTML 内容。它使用value 属性来设置输入值。

    这和你想写的一样。

    <input type="text">
        your value
    </input>
    

    它不起作用,这不是 angular.js 的错误。

    【讨论】:

    • 谢谢,确实有道理。我现在用 取得了相同的结果。
    • 我得到了同样的结果...
    猜你喜欢
    • 2016-01-21
    • 2014-01-14
    • 2014-03-31
    • 1970-01-01
    • 1970-01-01
    • 2015-09-22
    • 1970-01-01
    • 2016-05-29
    • 1970-01-01
    相关资源
    最近更新 更多