Arturo Arturo - 5 months ago 26
AngularJS Question

Create multiple buttons with Angular in a loop

I have a variable "options" that contains a list

['a', 'b', 'c']
, and like this is displayed on the

Now I want to create a button for each element in the list, with the index appended to the
and as the
, and displaying the text in the button.

This is my code, but however I only get an empty button. What's wrong?

<form id="choice" name='form' method="POST" action="/" ng-repeat="i, option in options">
<button id="button{{i}}" type="submit" value="{{i}}">{{option}}</button>

EDIT: I made my code easier and it still doesn't show any of the 3 options in the
but it shows properly the list in the
. Is it perhaps something that I need to install in order to run
? I have the
in the

<form id="choice" name='form' method="POST" action="/" ng-repeat="option in options">

I have this in the header:

<script src=""></script>


It seems it's just the missing brackets. Should be ng-repeat="(i, option) in options" in your case.