Hi i have list of Ids checkedContacts and boxPack is also list of ids, i want to compare both of them and make true. if checkedContact id and boxpack id matches.
<aura:attribute name="checkedContacts" type="Id[]" />
handleApplicationEventFired : function(component, event) {
var message = event.getParam("message");
alert('message'+message)
// set the handler attributes based on event data
component.set("v.messageFromEvent", message);
var a = component.get("v.checkedContacts");
if(a.length != 0)
{
var boxPack = component.find("dependent");
console.log('boxPack.len' + boxPack.length);
if (!Array.isArray(boxPack)) {
boxPack = [boxPack];
}
for (var i = 0; i < boxPack.length; i++) {
alert('boxpack'+boxPack[i].get("v.text"));
alert('checkedContacts'+(component.get("v.checkedContacts")[i]));
if(JSON.stringify(component.get("v.checkedContacts")[i])==boxPack[i].get("v.text"))
{
alert('inside');
boxPack[i].set("v.value", true);
}
}
}
}