Okay, so I have a constant variables in the _Layout.cshtml of ASP.Net SPA project and I would to pass them so that Angular will have access to those.
How can I do t
What is the problem? I have easily get value from an HTML page like this.
HTML
Angular 2 - Tour of Heroes
Loading...
Call Main Component file
alert(getThisValue);
import { bootstrap } from '@angular/platform-browser-dynamic';
import { HTTP_PROVIDERS } from '@angular/http';
import { AppComponent } from './app.component';
//import { enableProdMode } from '@angular/core';
//enableProdMode();
bootstrap(AppComponent, [HTTP_PROVIDERS]);
alert(getThisValue);
It's work for me
On thing I have notice in your code is you should use ''
mark to access url.
Replace this
var lenderValues = @Html.Action("GetLenderDropdownValues", "Dropdown");
with this
var lenderValues = '@Html.Action("GetLenderDropdownValues", "Dropdown")';
This is the simplest option to access value from HTML
of course not a proper way. To access this value you need to define a constant as defined in Thierry Templier
answer above.