Within my Node.js application, I have a file named variables.js
. This file contains variables that are used throughout the application in one central location:
exports.var1= 'a';
exports.var2= 'b';
By requiring this file in another page using the following code:
var variables= require('./variables');
I am able to access these variables in that page like so:
alert(variables.var1);
I am now looking to achieve the same functionality in Angular 2 (TypeScript). I have attempted to work with exports and imports but have been unable to successfully implement it. How can I achieve this in Angular 2 using TypeScript?