Weedoze Weedoze - 1 year ago 71
AngularJS Question

Angularjs input to increase a number of element

I have a simple input to enter a number.

When I enter a number, I want this number of buttons created directly below.

Example : I type in "8" in the input.
8 buttons are created below

<input type="text" placeholder="Number of steps" ng-model="nbrOfSteps">

Answer Source
<input type="number" ng-model="itemNumber" ng-change="generateButtons()">
  <button ng-repeat="button in list track by $index">button#{{$index}}</button>

In Controller

$scope.generateButtons = function(){
   $scope.list = [];


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download