How to insert to database range of numbers like this:
<form>
<input class="form-control"></input> <!-- insert first number -->
<input class="form-control"></input> <!-- insert last number -->
<button class="btn btn-primary">Add numbers to database</button>
</form>
in example:
first input: 1 second input: 100
this form should via ng-model add the items [1,2,3,4,5,6,7,8...,100] to database.
I just don't know how to make some loop here.
You can try to recover the min and the max value and try to loop in the contoller like that with a ng-click on the button :
the html
<form>
<input class="form-control" ng-model="myCTRL.minValue"></input> <!-- insert first number -->
<input class="form-control" ng-model="myCTRL.maxValue"></input> <!-- insert last number -->
<button class="btn btn-primary" ng-click="myCtrl.addRangeinArray()">Add numbers to database</button></form>
in the javascript
function addRangeinArray() {
for (number = vm.minValue;number < vm.maxValue;++number) {
mytab.push(number);
}
}