md-chip components with ng-repeat directive not shown on Codepen
md-chip components with ng-repeat directive are not shown.
Codepen Example based off of the Static Chips demo
In this case, the chips with the ng-repeat directive are not displayed at all:
<md-chips>
<md-chip>Normal Static Chip</md-chip>
<!-- Bug: Chips with ng-repeat directive do not display -->
<md-chip ng-repeat="i in [1, 2, 3]">ng-repeat Chip</md-chip>
</md-chips>
Same here.
Seeing the same issue.
The similar issue exists when <md-chips> component is used inside ng-repeat:
<div ng-repeat="i in [1,2,3]">
<md-chips>
<md-chip>Normal Static Chip</md-chip>
</md-chips>
</div>
Here only the last chip is displayed.
I wonder about that too, I guess it's the directive priority not high enough? Maybe lowering the priority for md-chips or md-chip would help fix this?
@sazonenka Same here.
ng-repeat on md-chip unavailable is not a big deal. But md-chips inside ng-repeat not working makes md-chips totally unusable.
Actually we have two different issues here. I have opened a new one. Those having issues about md-chips inside of ng-repeat please go to #3482 .
@sazonenka
@cnjsstong2 Not totaly unusable.
If you want a readonly chip list just set the readonly attribute to "true" on md-chips. Example with custom template:
<md-chips ng-model="ctrl.items" readonly="true">
<md-chip-template>
{{$chip.name}}
</md-chip-template>
</md-chips>
The md-chips uses ng-repeat internally so $chip is the item from the list you have provided in the ng-model.
@kvetis Thanks for the workaround!
+1 That works.
Since we have a workaround for the md-chip repeat issue, and 0.11 will close the md-chips repeat issue, can we go ahead and close this, or should we look at taking the time to support this use-case?
A cursory look seems like it might take quite a bit of refactoring to get this implemented.
@ThomasBurleson @robertmesserle Thoughs?
I still hope that md-chip can work with ng-repeat because it is difficult to set focus with the workaround method.
@du6 Can you elaborate on the focus issue? I'm not quite sure I understand what you mean.
@topherfangio Problem solved. Please ignore that comment. Sorry for any inconvenience.
Okay, since we have a workaround, and we haven't gotten any additional feedback, I'm going to go ahead and close this. If someone in the future would like us to reconsider, please post a comment we'll take a look.
with readonly="true" it leaves some space on the chip for the close icon, while with really static chips it doesn't.
@LeartS same here
This is still a problem for me because I am using the chips as a kind of tag editor for images. I can't have static chips because the user can add whatever tags they want.
@srukali Can you not use the ng-model attribute? A Codepen would be very helpful in understanding what you are trying to achieve :-)
@topherfangio This is a general idea of what I'm trying to do http://codepen.io/anon/pen/XdOxxV
For now I'm turning the editor into a component and then repeat from there.
@srukali Perhaps you can describe it a bit more, but this should actually work. We fixed the bugs that were causing problems with an ng-repeat outside of the chips. This issue was about something like the following:
<md-chips>
<md-chip ng-repeat="..."></md-chip>
</md-chips>
In your Codepen, it looks like your ctrl.tags variable is an empty array, but the ng-model on the chips, points to ctrl.tags[$index] which will be null/undefined.
Here is an updated one that I think will work as you expect: http://codepen.io/topherfangio/pen/LNqXWK