Open Closed

I want to send a request to api in the aspnetcore when the button is clicked #3805


User avatar
0
SafaFINDIK created
  • ABP Framework version: v4.4.2
  • UI type: Angular & Dotnet Core 5.0
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hello Abp Support, I am using Abp Framework Commercial. I added a button named as "Print Button" inside of Options. I successfully displayed it( You can see it on the first screenshot). I want to send a request to api(/api/user/print/) in the (aspnetcore) project that I have created when the relevant button is clicked, but I could not find a solution for my problem. I would appreciate your help. Thank you.

Screenshots 1- 2- 3- 4- 5-

Kind regards,

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

2 Answer(s)
  • User Avatar
    0
    muhammedaltug created

    Hello,

    Please remove the following route configuration from your app-routing.module.ts. Because IdentityExtendedModule has this logic. And please remove theentity-action-contributors.ts placed in the app folder.

    {
        path: 'identity',
        loadChildren: () => 
           import('@volo/abp.ng.identity').then(m => 
               m.IdentityModule.forLazy({
                   entityActionContributors: identityEntityActionContributors
               })
           ))
    }
    

    You can follow the same steps for "Adding quick view button to actions"

    • Define a method named 'requestMyApi' in IdentityExtendedComponent and implement like following
    requestMyApi(record: IdentityUserDto) {
        this.myService.myRequestMethod().subscribe(res => {
            console.log(res)
        });
    }
    
    • In your action definition inject IdentityExtendedComponent and execute this method.
    const printButtonAction = new EntityAction<IdentityUserDto>({
      text: 'PrintButton',
      action: data => {
        const component = data.getInjected(IdentityExtendedComponent);
        component.requestMyApi(data.record);
      },
    });
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    SafaFINDIK created

    Hello,

    Please remove the following route configuration from your app-routing.module.ts. Because IdentityExtendedModule has this logic. And please remove theentity-action-contributors.ts placed in the app folder.

    { 
        path: 'identity', 
        loadChildren: () =>  
           import('@volo/abp.ng.identity').then(m =>  
               m.IdentityModule.forLazy({ 
                   entityActionContributors: identityEntityActionContributors 
               }) 
           )) 
    } 
    

    You can follow the same steps for "Adding quick view button to actions"

    • Define a method named 'requestMyApi' in IdentityExtendedComponent and implement like following
    requestMyApi(record: IdentityUserDto) { 
        this.myService.myRequestMethod().subscribe(res => { 
            console.log(res) 
        }); 
    } 
    
    • In your action definition inject IdentityExtendedComponent and execute this method.
    const printButtonAction = new EntityAction<IdentityUserDto>({ 
      text: 'PrintButton', 
      action: data => { 
        const component = data.getInjected(IdentityExtendedComponent); 
        component.requestMyApi(data.record); 
      }, 
    }); 
    

    Hello, I added it to my code as follows according to your directives. Is it supposed to be like this?

    Screenshot:

    Or is it supposed to be like in Screenshot2 ? Screenshot2:

    But with both ways i couldn't reach requestMyApi. :(

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.