AngularJS Loops and Formatting

后端 未结 2 1009
清歌不尽
清歌不尽 2021-01-17 02:04

very new to AngularJS so please forgive me if this is a stupid question.

I need to output my data in a grid like format (using Ionic) and i need to have a div for a

2条回答
  •  有刺的猬
    2021-01-17 02:44

    Something like this? fiddle

    {{item}}

    I simply break the line every three items, but we could expand on this approach.

    Update with complete, working solution: fiddle

    {{items[$index]}} {{items[$index+1]}} {{items[$index+2]}}

    The code is pretty self-explaining: the solution creates a row every three elements, and inserts the elements only if they actually exist.

提交回复
热议问题