angularlinq

Filtering out data by LINQ syntax in Angular request. Error: character literal must contain exactly one character


I have this LINQ filter for my request in order to get only part of bigger dataset:

const coreFilter = `permissions != null && permissions.Any(p => p.permissionLevel != 'Hide' && p.areaIId == ${currentCustomer})`;

But it works properly only when I'm asking only for one parameter:

p.areaIId == ${currentCustomer})

If I want to filter by two parameters, I get this error:

enter image description here


Solution

  • single quotes represent a single character, and double quotes represent a string so

    'Hide'
    

    needs to be "Hide" - so something like

    const coreFilter = `permissions != null && permissions.Any(p => p.permissionLevel != "Hide" && p.areaIId == ${currentCustomer})`;