[Library | Trunk]: Add equals object function and change input chip label condition with it
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60949 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
a45915230c
commit
b600dc4756
|
@ -343,7 +343,7 @@ export class InputComponent implements OnInit, OnDestroy, OnChanges {
|
|||
}
|
||||
|
||||
getLabel(value: any) {
|
||||
let option = this.options.find(option => option.value === value);
|
||||
let option = this.options.find(option => HelperFunctions.equals(option.value, value));
|
||||
return (option) ? option.label : value;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,10 @@ export class HelperFunctions {
|
|||
}
|
||||
throw new Error("Unable to copy obj! Its type isn't supported.");
|
||||
}
|
||||
|
||||
public static equals(object1, object2) {
|
||||
return object1 === object2 || JSON.stringify(object1) === JSON.stringify(object2);
|
||||
}
|
||||
|
||||
public static encodeArray(elements: string[]): string[] {
|
||||
let encoded: string[] = [];
|
||||
|
|
Loading…
Reference in New Issue