Open Closed

How to pass Filter value angular to EF API #3035


User avatar
0
krushnakant created
  • **ABP Framework version:**4.4.3
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

I am using Angular UI part. I am not able to pass filter and pagination with out book example. I want to pass Filter and paging information How to pass Filter value angular to EF API please explain it I pass this type of senior

getBooklist(Filter){
    this.someFilterValue = 'kanti';
    if(Filter !=null){
      alert(Filter)
      const bookStreamCreator = (query) => this.authorService.getList({            
       
        ...query,
        ...Filter
       
      });
  
     this.list.hookToQuery(bookStreamCreator).subscribe((response) => {
    this.author = response;
   
       });
    }else{
      const authorStreamCreator = (query) => this.authorService.getList(query);

      this.list.hookToQuery(authorStreamCreator).subscribe((response) => {
        this.author = response;
      });
    }
    
  }
but i am not able to get filter value to EF API

6 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi @krushnakant

    I'm not sure what you mean by EF API. You should encapsulate your parameters with DTO and you can generate queries with those parameters in the repository.

    It's not recommended that expose entities or database queries directly to the client.

    • https://docs.abp.io/en/abp/5.2/Best-Practices/Application-Services#getting-a-list-of-entities

    If you mean passing MaxResultCount and SkipCount parameters, you can send them manually.

    this.authorService.getList({ "maxResultCount": 2, "skipCount": 4 });
    
  • User Avatar
    0
    krushnakant created

    Our EF API means Entity Framework Our ABP API. I want to pass filter parameter with angular to our paging this is server side pass parameter so please

  • User Avatar
    0
    krushnakant created

    my question is angular pass filter parameter to ABP Entity Framwark API . I want to pass paging and filter parameter are server side so please how to implement this?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Does your DTO has filter parameters that you want to send?

    Firstly you have to add parameters to your DTO and re-generate the client-proxy. Then you can pass those parameters that you've added to your dto. Then you can use however you want those parameters in the appservice.

    • Add Filter property to your dto, *if you don't use a specific DTO, create new one and replace PagedAndSortedResultRequestDto with it. *
    public class AuthorFilterDto : PagedAndSortedResultRequestDto
    {
        public string Filter { get; set; }
    }
    
    • Generate again the proxy in angular project.
    abp generate-proxy -t ng
    

    Then you can pass that parameter to the API via proxy.

    this.authorService.getList({
     "maxResultCount": 2, 
     "skipCount": 4,
     "filter": "some filter text"
    });
    

    Can you please share an example scenario? Then we can understand the issue clearly.

  • User Avatar
    0
    krushnakant created

    I done with same our book author example. In book author example not define pass filter value. Also you are not define page size parameter. Please refer our existing Book Author example and try to pass filter value.Our example is not fulfill to the developer. please correct it and introduce new one example. in angular example is not completed so please all things complete.

    you want example of filter please go with Book Author application and pass Filter with angular to our Entity Framework API

  • User Avatar
    0
    muhammedaltug created

    Hello,

    Can you send your component.ts and component.html file?

    Also you can check how to use ListService in documentation

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11