如何每4栏实现产品展示?

时间:2017-01-24 17:56:45

标签: javascript html angularjs materialize

我想要在每四件物品中展示我想要的产品。如何使用ng-repeat实现该任务?

main.html 的内容:

<div class="row">
        <div class="col s12 m4">
          <div class="card blue-grey darken-1" ng-repeat="laptop in data">
            <div class="card-content white-text">
              <span class="card-title">{{laptop.name}}</span>
            </div>
            <div class="card-action">
              <a href="#">{{laptop.Brand}}</a>
            </div>
          </div>
        </div>
      </div>

1 个答案:

答案 0 :(得分:2)

只需将ng-repeat放在col而不是row ..

<div class="row">
    <div class="col s12 m4" ng-repeat="laptop in data">
      <div class="card blue-grey darken-1">
        <div class="card-content white-text">
          <span class="card-title">{{laptop.name}}</span>
        </div>
        <div class="card-action">
          <a href="#">{{laptop.Brand}}</a>
        </div>
      </div>
    </div>
  </div>

示例:http://www.codeply.com/go/3rRmpU0NC3