Below, you will find a global JavaScript variable that is defined. Note that @Url is an ASP.Net MVC html helper and it will be converted to a string value:
<script>
var rootVar = '@Url.Action("Index","Home",new { Area = ""}, null)';
System.import('app').catch(function(err){ console.error(err); });
</script>
I am wondering how I can access the rootVar in an Angular 2 component. In Angular 1.5, I used the window service for this purpose. Is there a similar way of achieving this in Angular 2?
Specifically, I aim to use the rootVar variable to assist in generating the templateUrl in the following component:
import { Component, Inject} from '@angular/core';
@Component({
selector: 'home-comp',
templateUrl: '../Home/Root'
})
export class HomeComponent {
constructor( ) { }
}