This repository was archived by the owner on Nov 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
projects/angular-material-formio/src/lib/components/select Expand file tree Collapse file tree 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)">
@@ -45,7 +47,7 @@ export class MaterialSelectComponent extends MaterialComponent implements OnInit
45
47
selectOptions : Promise < any [ ] > ;
46
48
filteredOptions : Promise < any [ ] > ;
47
49
filteredOptionsLength : number ;
48
-
50
+
49
51
selectOptionsResolve : any ;
50
52
51
53
setInstance ( instance : any ) {
@@ -71,6 +73,10 @@ export class MaterialSelectComponent extends MaterialComponent implements OnInit
71
73
return filtered ;
72
74
} )
73
75
}
76
+
77
+ compareObjects ( o1 : any , o2 : any ) : boolean {
78
+ return _ . isEqual ( o1 , o2 ) ;
79
+ }
74
80
}
75
81
SelectComponent . MaterialComponent = MaterialSelectComponent ;
76
82
You can’t perform that action at this time.
0 commit comments