Ng-repeat does not work in md-chip

Why doesn't the md chip support ng-repeat?

<md-chips>
          <md-chip data-ng-repeat="category in book.categories">
            {{category.name}}
          </md-chip>
        </md-chips>
+4
source share
3 answers

with angular 1.3.15 / angular material 0.9.8, the following works here:

in the controller:

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

in HTML:

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

I think I was looking

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

Use the md-chip template instead of md-chip and use ng-model instead of ng-repeat .. as below.

<md-chips ng-model="user.skills" readonly="true">
    <md-chip-template>{{$chip.skill_title}}</md-chip-template>
</md-chips>

It should work as your expectation.

+5
source

All Articles