hasane has hasane has - 1 year ago 119
AngularJS Question

how to use md-chips with ng-repeat (key, value)

I'm trying to use md-chips with ng-repeat when using (key, value) flavor here is an example of what I'm trying to do :

<md-content class="md-padding" layout="column" ng-repeat="(key,value) in items">
<md-chips ng-model="???" name="fruitName" readonly="true" md-removable="" md-max-chips="5">
<strong>{{key}} :{{value}}</strong>

(I don't know what to do in the

thank you in advance


here is my json data for example {'a':'1','b':'2','c':'3'}

<md-chips class="custom-chips" ng-model="ctrl.vegObjs" readonly="true">
<strong> {{$chip}} </strong>

by using this code I can have {"a":"1"} {"b":"2"} {"c":"3"}, but it's not exactly what I want.

Answer Source

Try this

<md-chips ... ng-model="_key" ng-init="_key = [key]" ...></md-chips>

Working codepen