This repository was archived by the owner on Nov 13, 2024. It is now read-only.
File tree 1 file changed +7
-1
lines changed
projects/angular-material-formio/src/lib/components/select
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { Component , OnInit } from '@angular/core' ;
2
2
import { MaterialComponent } from '../MaterialComponent' ;
3
3
import SelectComponent from 'formiojs/components/select/Select.js' ;
4
+ import _ from 'lodash' ;
4
5
@Component ( {
5
6
selector : 'mat-formio-select' ,
6
7
template : `
@@ -20,6 +21,7 @@ import SelectComponent from 'formiojs/components/select/Select.js';
20
21
[formControl]="control"
21
22
[placeholder]="instance.component.placeholder"
22
23
(selectionChange)="onChange()"
24
+ [compareWith]="compareObjects"
23
25
>
24
26
<div class="mat-option">
25
27
<input class="mat-input-element" placeholder="Type to search" (input)="onFilter($event.target.value)">
@@ -44,7 +46,7 @@ export class MaterialSelectComponent extends MaterialComponent implements OnInit
44
46
selectOptions : Promise < any [ ] > ;
45
47
filteredOptions : Promise < any [ ] > ;
46
48
filteredOptionsLength : number ;
47
-
49
+
48
50
selectOptionsResolve : any ;
49
51
50
52
setInstance ( instance : any ) {
@@ -70,6 +72,10 @@ export class MaterialSelectComponent extends MaterialComponent implements OnInit
70
72
return filtered ;
71
73
} )
72
74
}
75
+
76
+ compareObjects ( o1 : any , o2 : any ) : boolean {
77
+ return _ . isEqual ( o1 , o2 ) ;
78
+ }
73
79
}
74
80
SelectComponent . MaterialComponent = MaterialSelectComponent ;
75
81
You can’t perform that action at this time.
0 commit comments