I have two arrays - one with a complete list of data and another with only a few items. My goal is to filter out the data from the complete list that is not present in the second array and create a new array with the filtered results.
Below are the details of the arrays:
$scope.allparams = [{
'tab': 'ADH',
'title': 'Adhérent'
}, {
'tab': 'ADH',
'data': 'civilite',
'lib': 'Civilité',
'type': 'select'
}, {
'tab': 'ADH',
'data': 'nom',
'lib': 'Nom',
'type': 'text'
}, {
'tab': 'ADH',
'data': 'prenom',
'lib': 'Prénom',
'type': 'text'
}, {
'tab': 'ADH',
'data': 'dateNaissance',
'lib': 'Date de naissance',
'type': 'date'
}, {
'tab': 'ADH',
'data': 'nationalite',
'lib': 'Nationalité',
'type': 'select'
}, {
'tab': 'ADH',
'data': 'statut',
'lib': 'Statut',
'type': 'select'
}, {
'tab': 'DET',
'title': 'Détail comptable',
'type': 'select'
}, {
'tab': 'DET',
'data': 'saison',
'lib': 'Saison',
'type': 'select'
}, {
'tab': 'DET',
'data': 'activite',
'lib': 'Activité',
'type': 'select'
}, {
'tab': 'DET',
'data': 'prix',
'lib': 'Prix',
'type': 'currency'
}];
if (exportService.getStockParams() !== undefined) {
var stockParams = exportService.getStockParams(); // Second array filled with a method
}
Here is an example of the second array:
[{
"tab": "ADH",
"data": "nom",
"lib": "Nom",
"ordersource": 2,
"added": true
}, {
"tab": "ADH",
"data": "prenom",
"lib": "Prénom",
"ordersource": 2,
"order": null,
"added": true
}, {
"tab": "ADH",
"data": "dateNaissance",
"lib": "Date de naissance",
"ordersource": 2,
"order": null,
"added": true
}]
Please let me know if you require more information.
I am new to Angular and finding the filters challenging to understand. Any help would be appreciated.