Danubio
Danubio

Reputation: 123

Ionic button ng-repeat

I'm trying to make a set of buttons that will determine the amount of render pieces that will take place on the next view but I would like to make the buttons dynamic with an ng-repeat. This is my code so far:

<button ion-button round block ng-repeat="item in [1, 2, 3, 4]">number!</button>

But this only renders 1 button. What I am doing wrong? Thanks in advance.

Upvotes: 0

Views: 166

Answers (1)

Tan Duong
Tan Duong

Reputation: 2142

For Angular 1.x in Ionic V1

<button ion-button round block ng-repeat="item in [1, 2, 3, 4]  track by $index">number!</button>

For Angular 4.x in Ionic V3

<button ion-button round block *ngFor="#key of [1, 2, 3, 4]">number!</button>

Upvotes: 1

Related Questions