in the below function the element data contains multiple record sets. What I want to do is filter it so that it returns only the row which has id same as 'selectedModelDrv'. I tried but getting all sorts of errors, can someone tell me the angular way of doing it?
vm.driverModelSelectorGo = function () {
var selectedModelDrv = vm.driver.driverModelId;
return datacontext.lookup.getLookupList(datacontext.lookupLists.driverModel).then(function (data) {
//Filter 'data' so that data.driverModelId == selectedModelDrv
})
};
Regards Max
.filter? lodash.com/docs#filter - or just loop through the data add anifconditional and push the item to a new array if it fits your conditions?