How to get the data displayed in the right place

test[
    ["good1","1"],
    ["good2","2"],
    ["good3","3"],
    ["good4","4"]
]

A piece of data as above will change, but not more than four

.

for example, sometimes it may be

test[
    ["good1","1"],
    ["good2","2"],
    ["good4","4"]
]


then I made four boxes on the page to put these four materials,

clipboard.png


clipboard.png

the fourth data goes to the position of the third data, because there are three left in the array, and the fourth moves up. If I grab the third, I will catch the fourth

.
test[
        ["good1","1"],
        ["good2","2"],
        ["good4","4"]
    ]

I want every data to be in the right place, the fourth should be in the fourth, and then the third will be empty

how do I do this?

Jun.09,2022

do a loop on the outer layer, so it doesn't matter how much data you will have in the future:


            <span>{{good[0]}}</span>
        </ng-container>
     </div>
</div>

if you get the original data, you can deal with it by yourself, and fill in the overhead array in the insufficient position, which can be used for general processing.
if you don't expand only four in the future, you just need to fill in an empty one in the data.

Menu