File tree Expand file tree Collapse file tree 4 files changed +292
-124
lines changed Expand file tree Collapse file tree 4 files changed +292
-124
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ <h4>Stacked Chips</h4>
128128 </ md-chip-list >
129129
130130 < h4 > NgModel with chip list</ h4 >
131- < md-chip-list [(ngModel)] ="selectedColors ">
131+ < md-chip-list [multiple] =" true " [ (ngModel)] ="selectedColors ">
132132 < md-chip *ngFor ="let aColor of availableColors " color ="{{aColor.color}} "
133133 [value] ="aColor.name " (remove) ="removeColor(aColor) ">
134134 {{aColor.name}}
@@ -137,6 +137,17 @@ <h4>NgModel with chip list</h4>
137137 </ md-chip-list >
138138
139139 The selected colors are < span *ngFor ="let color of selectedColors "> {{color}}</ span > .
140+
141+ < h4 > NgModel with single selection chip list</ h4 >
142+ < md-chip-list [(ngModel)] ="selectedColor ">
143+ < md-chip *ngFor ="let aColor of availableColors " color ="{{aColor.color}} "
144+ [value] ="aColor.name " (remove) ="removeColor(aColor) ">
145+ {{aColor.name}}
146+ < md-icon mdChipRemove > cancel</ md-icon >
147+ </ md-chip >
148+ </ md-chip-list >
149+
150+ The selected color is {{selectedColor}}.
140151 </ md-card-content >
141152 </ md-card >
142153</ div >
Original file line number Diff line number Diff line change @@ -93,4 +93,5 @@ export class ChipsDemo {
9393 this . visible = false ;
9494 }
9595 selectedColors : any [ ] = [ 'Primary' , 'Warn' ] ;
96+ selectedColor = 'Accent' ;
9697}
You can’t perform that action at this time.
0 commit comments