I want to create dynamically forms. Inside my controller i create a string
var str = "<input type='text' value='" + $scope.selectedData.code + "' class='form-control' />";
$scope.htmlString = $sce.trustAsHtml(str);
and in my html page
<div ng-bind-html="htmlString"></div>
i get the value but is not binding. I try also with
var str = "<input type='text' ng-model='" + $scope.selectedData.code + "' class='form-control' />";
$scope.htmlString = $sce.trustAsHtml(str);
also doesn't work. Can anyone know how can this work?
HTML :
Add a directive:
compile-template
JS :