将ng-repeat中的数据数组化为多个列和行,该怎么办?

时间:2019-01-09 16:27:38

标签: javascript jquery angularjs angularjs-ng-repeat

我手里有一个数组列表,我想用ng-repeat显示此数组listi,如图所示。 什么是正确的方法?

如果可能的话,我想做以下事情,盒子的四个侧面都有“ +”号。当我单击“ +”时,以这种方式单击它,我希望在该方向上创建的新框与其下的框数一样多。另一个选项是每个框中的删除图标。我希望在单击它们时删除该框。

我想要图像中的视觉效果。

enter image description here

vm.sections = {
    width: 3,
    matrix: [
      { name: "Left Text", position: "left" },
      { name: "Top Text", position: "top" },
      { name: "Right Text", position: "right" },
      { name: "Left Text", position: "left" },
      { name: "Center", position: "center" },
      { name: "Right Text", position: "right" },
      { name: "Left Text", position: "left" },
      { name: "Bottom Text", position: "bottom" },
      { name: "Bottom Text", position: "bottom" }
    ]
};
<div class="table">
    <div class="body">
        <div class="row" ng-if="(section.position==='top' || section.position==='bottom' || section.position==='center')"
             ng-repeat="section in sections.matrix track by $index">
          <div class="cell section"
               ng-repeat="section in sections.matrix track by $index">
            {{ section.name }}
          </div>
        </div>
    </div>
</div>

0 个答案:

没有答案