我有许多数组需要在单个 td
内进行ng-repeat
。例如,{"Locations":["San Francisco, CA","Los Angeles, CA"]}
,其中 td
需要如下所示
<td>San Francisco, CA,Los Angeles, CA</td>
或 {"Locations":["波士顿","洛杉矶","伦敦","纽约","香港","华盛顿","西雅图","亚特兰大","旧金山","Sydney","Austin"]}
,其中 td
需要看起来像
<td>Boston,Los Angeles,London,New York, Hongkong, Washington, Seattle, Atlanta, San Francisco, Sydney, Austin</td>
我尝试了很多不同的方法,但它们似乎都在重复td
...以下是我尝试过的一些方法:
td(ng-repeat-start="location in currentSchools.Locations") {{location}}
和
tr(ng-repeat="location in currentSchools.Locations")
td
| {{location}}
最佳答案
您可以使用<span>
里面的标签<td>
元素并在 span 元素上使用 ng-repeat
关于javascript - 如何在 td 内部重复数组,以便 td 包含所有数组值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31459866/