How to Pass a variable from C# to Angular Service with pre-render enabled? #942

Closed
opened 2025-08-09 17:18:16 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @JohnGalt1717 on 3/13/2017

I'm trying to setup a client service that is shared with all of our web properties that is a full client library of calls to REST that is generated by our backend API so that we don't end up with decoupling errors.

So far I wanted to use C# applicationsettings.json file to store the Service's url so that developers could have one and it would be overriden with an environment variable on Azure.

However the only way I can see to inject this is as a javascript variable on the Index.cshtml.

The problem is that node then freaks out on pre-render with very useless error messages.

How can I get this working so that this can be generically passed on startup and node will be happy?

*Originally created by @JohnGalt1717 on 3/13/2017* I'm trying to setup a client service that is shared with all of our web properties that is a full client library of calls to REST that is generated by our backend API so that we don't end up with decoupling errors. So far I wanted to use C# applicationsettings.json file to store the Service's url so that developers could have one and it would be overriden with an environment variable on Azure. However the only way I can see to inject this is as a javascript variable on the Index.cshtml. The problem is that node then freaks out on pre-render with very useless error messages. How can I get this working so that this can be generically passed on startup and node will be happy?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#942
No description provided.