I have defined several variables in my .cshtml file to be used in my angular services:
<script>
var _APIURL = '@(Url.Content("~/Admin/api/"))';
var _AREAURL = '@(Url.Content("~/Admin/"))';
var _APPURL = '@(Url.Content("~/"))';
var _AREAPATH = "@(Url.Content("~/") + "Areas/" + HttpContext.Current.Request.RequestContext.RouteData.DataTokens["area"])";
</script>
Now, within my module, I need to access these variables like so:
((): void => {
var app = angular.module('system', ['ngRoute', 'ui.bootstrap', 'gettext', 'ngCookies', 'ipCookie']);
app.constant("_AREAPATH", _AREAPATH); // value retrieved from the view
app.constant("_AREAURL", _AREAURL); // value retrieved from the view
app.constant("_APPURL", _APPURL); // value retrieved from the view
app.config(["$routeProvider", "_AREAPATH", ($routeProvider, areaPath) => {
$routeProvider
.when('/', { templateUrl: areaPath + "/Templates/System/System.html" })
.otherwise({
template: "This doesn't exist!"
});
}]);
})()
However, I am facing a "Cannot resolve symbol _AREAURL" error. How can I address this issue?