Vote count:
0
a.html
<div ng-bind-html="htmlElement()"></div>
controller.js
$scope.htmlElement = function(){
var html = '<input type="text" ng-model="myModel" />';
return $sce.trustAsHtml(html);
}
But when I want to get the value of the text input using
alert($scope.myModel);
It says myModel is undefined. It only happens when I add the text input dynamically.
How can I get the value of that text input?
asked 16 secs ago
ng-bind-html not working as expected
Aucun commentaire:
Enregistrer un commentaire