I have two files, 'Drawer.ts'
and the 'sidenav-open-close.component.ts'
componenet.
I need a variable to be shared between these two, with the option to change it's value in 'Drawer.ts'
, and 'sidenav-open-close.component.ts'
will act accordingly.
I tried using this method - What is the best way to declare a global variable in Angular 2 / Typescript and created a file named globals.ts with these conntent:
'use strict';
export var diffMode : boolean = false;
and imported it in both files with import * as myGlobals from './src/globals.ts';
I managed to read diffMode, but when trying to set it through 'Drawer.ts'
i get the following error:
ERROR TypeError: Cannot set property diffMode of [object Object] which has
only a getter
Help will be appreciated, Thanks.