I recently developed a small test website using typescript and angularjs.
Within my project, there is a module that contains a static variable which I would like to connect to the HTML document in order to display the currently logged-in user.
module mytest.constants {
export class CurrentSession {
public static CURRENT_USER: string = "Tobi";
}
}
The issue at hand is that the current scope resides in a controller that is separate from my CurrentSession class.
I am hoping to achieve something like this:
<div class="label" style="color:green">
Logged in as: {{mytest.constants.CurrentSession.CURRENT_USER}}
</div>
An alternative approach could involve adding a class member to the controller and setting it within the constructor like so:
this.CurrentUser = mytest.constants.CurrentSession.CURRENT_USER
However, I would prefer to directly bind the static variable to the HTML file. Is this task feasible?