What if you built an array of adults, myAdults, and then ng-repeated the form, like such: jsBin
<form ng-repeat="adult in myAdults">
<h4>Hello</h4>
<div class="form-group">
<label class="col-lg-2 control-label">
Email
</label>
<div class="col-lg-10">
<input type="text" ng-model="adult.name" placeholder="Email"
id="inputEmail" class="form-control" />
{{adult}}
</div>
</div>
</form>
And the JS:
$scope.adults = 4;
$scope.children = 2;
$scope.myAdults = [];
for (i = 0; i < $scope.adults; i ++) {
$scope.myAdults.push({});
}
So:
Can I dynamically add html from a controller? Yes, but you shouldn't
Should I be using a directive and how can I do it? If you went the route of dynamically generating the HTML, yes you should, if you go the route of using the built in ng-repeat, no need.