I'm using the ng-bind-html
function to generate input fields for editing text stored in a database on my application. I'm using the $sce
and allowing unsafe-html as input will not show up without doing so.
The generated HTML looks like so:
<input class="edit-db"
ng-model="db[index-1].values[0][0].value"
type="text" placeholder="Enter your answer...">
This will generate an Input field, however the value will be blank. (and not the value of db[index-1].values[0][0].value
However, if I copy the generated HTML and put it into my application manually (without generating it using ng-bind-html
) the value shows up. This is telling me that there isn't an issue with the generated code.
Is this a bug with AngularJS
, or am I just doing something wrong. Considering if the input is added to the page manually the value appears I'm assuming there's a bug somewhere.
For the users that will ask "Well why not just manually have the input fields in the page" - That is because the amount of inputs is dynamic and changes based on the amount of values present.