title: Passing Data from ASP.NET Core to Typescript in Angular Cli-based App
body: <p>I am trying to setup a SPA where I can pass data from my appsettings.json to my clientside on server render. I followed the steps to configure SSR using the new SpaServices Templates</p>
  
  <p><a href="https://docs.microsoft.com/en-us/aspnet/core/spa/angular" rel="noreferrer">https://docs.microsoft.com/en-us/aspnet/core/spa/angular</a></p>
  
  <p>However I am not understanding how to accomplish the task labeled here</p>
  
  <blockquote>
    <p>You can pass this to other parts of your app in any way supported by Angular</p>
  </blockquote>
  
  <p>I see the example that is used is base_url, but it seems that base is injected into the page as a DOM element </p>
  
  <pre><code> &lt;base href='/'&gt;
  </code></pre>
  
  <p>But it is not clear how to read other items in this manner. I am testing passing whether the app is Https or not, I have this section in my Startup.cs</p>
  
  <pre><code>options.SupplyData = (context, data) =&gt;
  {
      data["isHttpsRequest"] = context.Request.IsHttps;
  };
  </code></pre>
  
  <p>and in main.server.ts</p>
  
  <pre><code> { provide: 'isHttps', useValue: params.data.isHttpsRequest }
  </code></pre>
  
  <p>but it is in main.ts that I get lost, I have something like this</p>
  
  <pre><code>export function getBaseUrl() {
    return document.getElementsByTagName('base')[0].href;
  }
  
  export function getIsHttps() {
    // NO idea what needs to go here
    return "";
  }
  
  const providers = [
    { provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] },
    { provide: 'isHttps', useFactory: getIsHttps, deps: [] }
  ];
  </code></pre>
  
  <p>I am not sure how SpaServices injects the value on Prerender into the app (I looked through the code but it isn't clear to me). Is the value put on window? How do I read the value so I can inject into constructors on components?</p>