index.html
<div ng-bind-html="htmlElement()"></div>
app.js
$scope.htmlElement = function(){
var html = '<input type="text" ng-model="myModel" />';
return $sce.trustAsHtml(html);
}
However, when attempting to retrieve the value of the text input using
alert($scope.myModel);
An error is encountered stating that myModel is undefined. This issue arises only when dynamically adding the text input.
Is there a solution to obtain the value of the dynamically added text input?