Two files exist, one named 'Drawer.ts'
and the other is the
'sidenav-open-close.component.ts'
component.
A variable needs to be shared between these two files. It should have the flexibility to be updated in 'Drawer.ts'
, with the
'sidenav-open-close.component.ts'
responding accordingly.
An attempted method was using the following link - What is the best way to declare a global variable in Angular 2 / Typescript and creating a file called globals.ts with this content:
'use strict';
export var diffMode : boolean = false;
This file was then imported into both files using
import * as myGlobals from './src/globals.ts';
The variable diffMode could be read successfully, but encountering an error when attempting to update it through 'Drawer.ts'
:
ERROR TypeError: Cannot set property diffMode of [object Object] which has
only a getter
Your assistance would be greatly appreciated. Thank you.