Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

AppConsts in Angular #9994


User avatar
0
ashjackson created

Prerequisites

  • What is your product version? V10.1.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? net50

Hi There,

I have some AppConsts set in the API project for various fieldlengths - are these exposed anywhere in the angular project to save duplication when validating input?

Kind Regards, AJ.


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ashjackson,

    No, consts on the server side are not shared with clients. You can use AppConsts.ts in Angular or you can return consts using an AppService but we prefer defining them in Angular app.

  • User Avatar
    0
    ashjackson created

    Hi There, A further question to this point, how do the values from appconfig.json get assigned to their partners in AppConsts.ts? If I wanted to add my a new value to AppConsts which is defined in appcondig.json, can I simple add to both files, or is there another class which reads in and assigned the values?

    Kind Regards, AJ.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Another option would be returing the values you want from SessionAppService's GetCurrentLoginInformations method. This will be transferred to Angular app and can be assigned to values on session object here. Then, you can access these values on your Angular app.

  • User Avatar
    0
    ashjackson created

    Thankyou, this will be very useful.