Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng-repeat not working in md-chip

Why is md-chip not supporting ng-repeat?

<md-chips>
          <md-chip data-ng-repeat="category in book.categories">
            {{category.name}}
          </md-chip>
        </md-chips>
like image 931
Sudhir Shrestha Avatar asked Dec 11 '22 22:12

Sudhir Shrestha


2 Answers

It seems I was looking for,

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

You bind it in ng-model to the md-chips tag instead of ng-repeat and then access the chip element by using $chip element inside the template tag.

like image 68
Sudhir Shrestha Avatar answered Dec 29 '22 22:12

Sudhir Shrestha


Use the md-chip-template instead of md-chip and use ng-model instead of ng-repeat.. like bellow.

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

It should be work as your expectation.

like image 32
user3391137 Avatar answered Dec 29 '22 20:12

user3391137