Invalid or unexpected token at new Function of Enumerable using linqjs

84 Views Asked by At

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

enter image description here

0

There are 0 best solutions below