i'm trying to append inside the div "otherfield", a directive element,
using while loop in the controller, who is binded to html using updateBoxes function:
HTML
<input type="number" min="2" class="form-control" id="numero_campi" ng-model="numerovoices" ng-change="updateBoxes(numerovoices)">
<div id="otherfield"></div>
JS
//DIRECTIVE
app.directive("listDirective", function() {
return {
restrict: 'E',
template : "<h1>This will repeated!</h1>"
};
$scope.updateBoxes = function(param){
var el = document.getElementById('otherfield');
var i = 0;
while (i < param) {
angular.element(el).append('<list-directive></list-directive>');
i++;
}
}
I'm doing right? it do't work for me...