ng-bind-html inside input text does not bind
Asked Answered
S

1

6

Inside a ng-repeat, following code does not work:

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

Following does:

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

I guess ng-bind-html is unable to bind to a input element?

Also does ng-bind-html actually bind the element with the model (here row.value)

Shape answered 26/12, 2013 at 3:34 Comment(0)
A
7

That's because input element cannot have innerHTML content. It uses value attribute instead to set the input value.

That's the same as you'd try to write.

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

It will not work and that's not angular.js fault.

Alver answered 26/12, 2013 at 3:36 Comment(2)
Thanks, does makes sense. I have achieved the same results with <input ng-model="row.value" > now.Shape
I made same result by this... <input type="text" ng-model="name" value="John"> <input type="text" value = {{name}} >Gid

© 2022 - 2024 — McMap. All rights reserved.