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>
128
128
</ md-chip-list >
129
129
130
130
< h4 > NgModel with chip list</ h4 >
131
- < md-chip-list [(ngModel)] ="selectedColors ">
131
+ < md-chip-list [multiple] =" true " [ (ngModel)] ="selectedColors ">
132
132
< md-chip *ngFor ="let aColor of availableColors " color ="{{aColor.color}} "
133
133
[value] ="aColor.name " (remove) ="removeColor(aColor) ">
134
134
{{aColor.name}}
@@ -137,6 +137,17 @@ <h4>NgModel with chip list</h4>
137
137
</ md-chip-list >
138
138
139
139
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}}.
140
151
</ md-card-content >
141
152
</ md-card >
142
153
</ div >
Original file line number Diff line number Diff line change @@ -93,4 +93,5 @@ export class ChipsDemo {
93
93
this . visible = false ;
94
94
}
95
95
selectedColors : any [ ] = [ 'Primary' , 'Warn' ] ;
96
+ selectedColor = 'Accent' ;
96
97
}
You can’t perform that action at this time.
0 commit comments