Open Closed

Expression parameter in JavaScript #72


0
cosmic created

Hi, I have this app service:

public ListResultOutput<RecordDto> GetAllFilter(Expression<Func<Record, bool>> predicate)
{
    var items = _recordRepository.GetAllList(predicate);

    return new ListResultOutput<RecordDto>
    {
        Items = items.MapTo<List<RecordDto>>()
    };
}

I tried call this service from JavaScript code, but it didn't work:

abp.services.app.record.getAllFilter(function(r){
    return r.recordType = 20;
}).done(function (data) {
    for (var i = 0; i < data.items.length; i++) {
        records.push([i, data.items[i].points]);
    }
});

How I can call this service from JavaScript code right way? Is it possible?


1 Answer(s)
  • 0
    hikalkan created

    Hi,

    It's beyond capabilities of dynamic web api layer. Also, you can not do it with simply ASP.NET Web API as I know. You can use BreezeJs or OData for querying server data from client. While it's not scope of ABP, there is no reason to not to use any library within an ABP based solution.