I'm looking to dynamically create a new form whenever an item is added to an array. The form remains consistent, but the conditional count increases each time.
Here's an example:
<span ng-show="companydata.selectedloc.length == 0">
<div angucomplete-alt id="ex1"
selected-object="selectedLocation"
></div>
</span>
<span ng-show="companydata.selectedloc.length == 1">
<div angucomplete-alt id="ex1"
selected-object="selectedLocation"
></div>
</span>
<span ng-show="companydata.selectedloc.length == 2">
<div angucomplete-alt id="ex1"
selected-object="selectedLocation"
></div>
</span>
Each code block adds an item to companydata.selectedloc when selected (using an autocomplete select input).
Check out the JavaScript function:
$scope.selectedLocation = function(selected){
$scope.companydata.selectedloc.push(selected)
}
Instead of manually increasing the condition and adding more code blocks up to a limit of 10, is there a more elegant way to accomplish this task?