BEST
DEALS
OF THE
YEAR!
SAVE UP TO $3,000
24 NOV
1 DEC
00 Days
00 Hrs
00 Min
00 Sec
Open Closed

Angular proxies generated by abp generate-proxy not using inject() #10119


User avatar
0
JanneHarju created

Is it possible to configure how angular proxies are generated? Now with newer angular versions it is preferred way to use inject() instead of constructor injection. So generate tool is still generating this to proxy services:

constructor(private restService: RestService) {}

Instead preferred way would be

private restService = inject(RestService);

If proxy generation is no possible to configure that way, could you update your abp-generate script to generate proxies with inject?

And I will once again tell you that this support form has weird question at end. "Tiered (MVC) or Auth Server Separated (Angular)" and only options is yes and no. What does yes mean? Does it mean MVC or Separated.


4 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    1. Solution
    • Today, the Angular service proxy generator (abp generate-proxy -t ng) produces services that use constructor injection:
    @Injectable({ providedIn: 'root' })
      export class BookService {
        apiName = 'Default';
    
        constructor(private restService: RestService) {}
      }
    

    There is no documented or supported option to configure the generator to use Angular’s inject() function instead of constructor injection in generated proxies. If you want to adopt inject() in your own code, you can still use it in your application services/components that consume the generated proxies, but the generated proxies themselves are not configurable to switch to inject().

    • Recommendation if you need inject() in proxies:
      • Keep using the generated proxies as-is.
      • Optionally wrap a generated proxy in your own thin service that uses inject() and delegates to the proxy, e.g.:
    import { Injectable, inject } from '@angular/core';
        import { BookService as GeneratedBookService } from '@proxy/books';
    
        @Injectable({ providedIn: 'root' })
        export class BookClient {
          private readonly proxy = inject(GeneratedBookService);
    
          getList() {
            return this.proxy.getList();
          }
        }
    
    • Alternatively, after generation you could run a custom codemod in your repo to transform constructors to inject(), but note this is outside ABP’s official tooling and you would re-run it after each proxy regeneration.

    • About the “Tiered (MVC) or Auth Server Separated (Angular): Yes/No” field:

      • “Yes” indicates you are using a separated/tiered setup where the Auth Server (MVC/Razor Pages) is separate from the Angular UI (i.e., the standard “Auth Server Separated (Angular)” deployment).
      • “No” indicates a non-tiered setup (Auth server not separated).
      • The label mentions both “Tiered (MVC)” and “Auth Server Separated (Angular)” because they refer to the same concept from different template perspectives. Selecting “Yes” means “Separated/Tiered”; it does not distinguish MVC vs Angular specifically—just that you use the separated variant.
    1. Sources
    • Service Proxies (Angular) documentation:
      • https://docs.abp.io/en/abp/latest/UI/Angular/Service-Proxies

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    JanneHarju created

    Can support team answer this and add it to your backlog if you are willing to make this change?

  • User Avatar
    0
    sumeyye.kurtulus created
    Support Team Angular Expert

    Hello,

    We have done this migration in the latest 10.0 version in this issue. You can check this release post for the details.

    Thank you for your cooperation.

  • User Avatar
    0
    JanneHarju created

    Ok nice. I will close this then.

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.1.0-preview. Updated on November 11, 2025, 06:29
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.