0

I am developing angular 4 application with Visual studio 2017 dot net core. want to access appsetting.json configuration key on typescript file.Also, I am able to access appsetting.json key on on startup.cs file.But need to access the appsetting.json configuration key from typescript.TS file.

please advise.

david d
  • 43
  • 1
  • 2
  • 4
  • startup.cs file code.... var config = Configuration.GetSection("Application").Get(); below object used to acsess thekey public class Application { public string ServiceUrl { get; set; } } – david d Apr 30 '18 at 13:14
  • In Visual Studio 2007 Core the files you can use must been in the folder wwwroot (you can create a directory in this folder called "config, e.g., so you can ask about "/config/data.json") – Eliseo Apr 30 '18 at 14:47

1 Answers1

0

If you're using the angular-cli then you have the enviroment.ts file to store your app settings.

You could load the appsettings.json file in typescript directly, but it does create a dependancy on the dot net core infrastructure.

See App.settings - the Angular way? for the range of options

Dean Marcussen
  • 597
  • 4
  • 15