var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.result="";
$scope.addPlant = function(){
for (i=0; i<$scope.someValue;i++){
//do something
$scope.result=$scope.result+i.toString()+",";
}
};
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>
document.write('<base href="' + document.location + '" />');
</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.4.x" src="https://code.angularjs.org/1.4.8/angular.js" data-semver="1.4.8"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<input type=number ng-model="someValue" />
<button ng-click="addPlant()">CLICK ME</button>
<div>{{result}}</div>
</body>
</html>
/* Put your css in here */