How to flatten with ng-repeat

后端 未结 2 1518
[愿得一人]
[愿得一人] 2021-01-19 19:48

I have:

    businesses: [
    {businessName: \'A\', \"address\":[loc1, loc2, loc3]},
    {businessName: \'B\', \"address\":[loc1, loc2]},
    {businessName:          


        
2条回答
  •  感情败类
    2021-01-19 20:02

    Seems like you could process it a bit, something like:

    var flatBusinesses = [];
    for (business in businesses) {
        for (address in business.addresses) {
            flatBusinesses.push ({name: business.name, address: address.City, state: address.State}
        }
    }
    

    And then just repeat on flatBusinesses in the view

提交回复
热议问题