[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:
k.triantafyllou 2021-04-21 15:28:35 +00:00
parent a45915230c
commit b600dc4756
2 changed files with 5 additions and 1 deletions

View File

@ -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;
}

View File

@ -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[] = [];