In regular JavaScript we can add a property to window global object with name from string, like this:
const str = "myVar";
window[str] = "Value";
console.log(myVar);
But is there a way to do the similar job in Angular 2/4 and Typescript? We can store regular variables in component using this.myVar, but is there a way to create the same variable using string for the variable name? Something like:
const str = "myVar";
this[str] = "Value";
// the result should be the similar as this.myVar = "Value";


windowobject.