离子按钮ng-repeat

时间:2018-04-21 23:29:31

标签: angularjs ionic-framework

我试图制作一组按钮来确定将在下一个视图中发生的渲染片数量,但我想通过ng-repeat使按钮动态化。 到目前为止,这是我的代码:

https://api.myjson.com/bins/w7wuz?id=1
https://api.myjson.com/bins/w7wuz?id=2&name=kaushal

但这只会呈现1个按钮。我做错了什么? 提前谢谢。

1 个答案:

答案 0 :(得分:1)

Angular 1.x

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

Angular 4.x

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