I have an application on ASP.NET MVC Core 2.0
using React Template
.
I have propertie in config file on server side - SiteURL
. I need to push it to client TypeScript
, and don`t understand how can I make it?
I tried to push them throw Home/Index
file by placing in the last script
SiteProps.SiteURL= "http://mysiteurl.org"
and on client I make
export var SiteProps: { SiteURL: string } = {SiteURL: ""};
and import this file on boot
But testing this property on console I see
Uncaught ReferenceError: SiteProps is not defined
I think that JavaScript
did't see my propertie from TypeScript
context.
The question is how to make this code work, and what is the best practice to push const values (properties) to client TypeScript
code.