File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
src/material-examples/chips-autocomplete Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 4
4
*ngFor ="let fruit of fruits "
5
5
[selectable] ="selectable "
6
6
[removable] ="removable "
7
- (remove ) ="remove(fruit) ">
8
- {{fruit.name }}
7
+ (removed ) ="remove(fruit) ">
8
+ {{fruit}}
9
9
< mat-icon matChipRemove *ngIf ="removable "> cancel</ mat-icon >
10
10
</ mat-chip >
11
11
< input
Original file line number Diff line number Diff line change @@ -26,14 +26,15 @@ export class ChipsAutocompleteExample {
26
26
filteredFruits : Observable < any [ ] > ;
27
27
28
28
fruits = [
29
- { name : 'Lemon' } ,
29
+ 'Lemon' ,
30
30
] ;
31
31
32
32
allFruits = [
33
- 'Orange' ,
34
- 'Strawberry' ,
35
- 'Lime' ,
36
33
'Apple' ,
34
+ 'Lemon' ,
35
+ 'Lime' ,
36
+ 'Orange' ,
37
+ 'Strawberry'
37
38
] ;
38
39
39
40
@ViewChild ( 'fruitInput' ) fruitInput : ElementRef ;
@@ -50,7 +51,7 @@ export class ChipsAutocompleteExample {
50
51
51
52
// Add our fruit
52
53
if ( ( value || '' ) . trim ( ) ) {
53
- this . fruits . push ( { name : value . trim ( ) } ) ;
54
+ this . fruits . push ( value . trim ( ) ) ;
54
55
}
55
56
56
57
// Reset the input value
@@ -73,7 +74,7 @@ export class ChipsAutocompleteExample {
73
74
}
74
75
75
76
selected ( event : MatAutocompleteSelectedEvent ) : void {
76
- this . fruits . push ( { name : event . option . viewValue } ) ;
77
+ this . fruits . push ( event . option . viewValue ) ;
77
78
this . fruitInput . nativeElement . value = '' ;
78
79
}
79
80
}
You can’t perform that action at this time.
0 commit comments