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)
-
0
- 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.
- 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.
-
0
Can support team answer this and add it to your backlog if you are willing to make this change?
-
0
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.
-
0
Ok nice. I will close this then.