Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(chips): when adding items, duplicates will now be skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Messerle committed Apr 9, 2015
1 parent 00011bd commit 1ba926b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/chips/demoBasicUsage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

<md-chips ng-model="ctrl.roFruitNames"
readonly="ctrl.readonly">
<md-chip-template>fruit:<strong>{{$chip}}</strong></md-chip-template>
<md-chip-template>
<strong>{{$chip}}</strong>
<em>(fruit)</em>
</md-chip-template>
</md-chips>

<p>
Expand Down
1 change: 1 addition & 0 deletions src/components/chips/js/chipsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
* @param newChip
*/
MdChipsCtrl.prototype.appendChip = function(newChip) {
if (this.items.indexOf(newChip) + 1) return;
if (this.useMdOnAppend && this.mdOnAppend) {
newChip = this.mdOnAppend({'$chip': newChip});
}
Expand Down

0 comments on commit 1ba926b

Please sign in to comment.