Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng-bind-html inside input text does not bind

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)

like image 644
Vikas Singhal Avatar asked Dec 26 '13 03:12

Vikas Singhal


1 Answers

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.

like image 71
MarcinJuraszek Avatar answered Oct 12 '22 08:10

MarcinJuraszek