I resolve my problem with a tricks (i’m not proud of it).
Currently i get my 2 arrays of data from api call.
If i use the base array it does not work.
But if i do someting like that :
let i = 0;
let j = 0;
while (i < this.currentLanguage.length) {
while (j < this.languagesData.length) {
if (this.currentLanguage[i].id == this.languagesData[j].id)
this.finalLanguage.push(this.languagesData[j]);
j += 1;
}
j = 0;
i += 1;
}
It works when i use finalLanguage instead of currentLanguage.
I don’t really understand why …
How can i pass the ref of an array to transform this :
let i = 0;
let j = 0;
this.finalSkill = [];
while (i < this.currentSkill.length) {
while (j < this.skillsData.length) {
if (this.currentSkill[i].id == this.skillsData[j].id)
this.finalSkill.push(this.skillsData[j]);
j += 1;
}
j = 0;
i += 1;
to this :
this.finalSkill = [];
this.help.GetArray(this.currentSkill, this.skillsData, this.finalSkill);
/* **** */
GetArray(arr1, arr2, res){
let i = 0;
let j = 0;
while (i < arr1.length) {
while (j < arr2.length) {
if (arr2[i].id == arr1[j].id)
res.push(arr2[j]);
j += 1;
}
j = 0;
i += 1;
}
}
I want to use extern function to avoid having 4684654 lines in one controller. And several time the same code.