Weedoze Weedoze - 9 months ago 34
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">

<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 = [];