Angular: Empty Fiddle
http://angularjs.org/
HTML
<script src="https://code.angularjs.org/1.5.2/angular.js"></script>
<div ng-controller="MyCtrl">
<div ng-repeat="product in colors">
<div ng-if="quan!=true">
<select ng-model="product.selectedItems.val" ng-init="product.selectedItems.val = product.selectedItems.val + ''">
<option ng-repeat="value in arr | limitTo:quantity">{{value}}</option>
</select>
</div>
</div>
<div>
<a href="#" ng-click="submit()">Submit</a>
</div>
</div>
JavaScript
var myApp = angular.module('myApp', []);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
myApp.controller('MyCtrl', function MyCtrl($scope) {
$scope.colors = [{
id: '1',
name: 'blue'
}, {
id: '2',
name: 'white'
}, {
id: '3',
name: 'red'
}];
$scope.quan = false;
$scope.arr = [];
for (var a = 1; a <= 10; a++) {
$scope.arr.push(a);
}
$scope.colors.map(function(obj) {
return obj.selectedItems = {
val: $scope.arr[0]
}
})
$scope.quantity = 10;
$scope.submit = function() {
$scope.colors.forEach(function(obj) {
console.log(obj.selectedItems.val)
})
}
});