ng-repeat在md-chip中不起作用

时间:2015-06-15 07:10:02

标签: angularjs angular-material

为什么md-chip不支持ng-repeat?

<md-chips>
          <md-chip data-ng-repeat="category in book.categories">
            {{category.name}}
          </md-chip>
        </md-chips>

3 个答案:

答案 0 :(得分:5)

似乎我在寻找,

<md-chips ng-model="book.categories" readonly="true">
          <md-chip-template>
            <strong>{{$chip.name}}</strong>
          </md-chip-template>
        </md-chips>

答案 1 :(得分:5)

使用md-chip-template代替md-chip并使用ng-model而不是ng-repeat ..如下所述。

   SELECT discid AS Discussion_ID, COUNT(*) AS occurences
    FROM comments
    GROUP BY discid
    ORDER BY occurences DESC
    LIMIT 4

应该按照你的期望工作。

答案 2 :(得分:3)

角度为1.3.15 /角度材料0.9.8,以下是:

在控制器中:

$scope.myNumbers = [ 1, 2, 3 ];
HTML中的

  <md-chips ng-model="myNumbers" readonly="true">
  </md-chips>