I want to return an object using Enumerable of linqjs. But this code gives an error "Invalid or unexpected token". When I check the same condition using if condition in forEach
then it is working perfectly. But what's problem with Enumerable
?
Using Linqjs
var checkAddressForUpdate = Enumerable.From($scope.companyAddresslist).Where("$.Address === '" + $scope.ad_CompanyAddress.Address + "' && $.SlNo !== " + $scope.ad_CompanyAddress.SlNo).FirstOrDefault();
Using If Condition
var checkAddressForUpdate;
angular.forEach($scope.companyAddresslist, function (comAddress) {
if (comAddress.Address == $scope.ad_CompanyAddress.Address && comAddress.SlNo != $scope.ad_CompanyAddress.SlNo) {
checkAddressForUpdate = comAddress;
}
});
Error in console