Currently, I am utilizing an older module called angular-2-local-storage
. The initialization process is as follows:
const LOCAL_STORAGE_SERVICE_CONFIG_TOKEN: string = 'LOCAL_STORAGE_SERVICE_CONFIG';
export const LOCAL_STORAGE_SERVICE_CONFIG = new OpaqueToken(LOCAL_STORAGE_SERVICE_CONFIG_TOKEN);
...and within my code:
@NgModule({
.....
providers: [
LocalStorageService,
{
provide: LOCAL_STORAGE_SERVICE_CONFIG,
useValue: { prefix: 'miswap' }
},
{
Yet, during the build of my project, I encounter the following error message:
Error: Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler (position 2:22 in the original .ts file), resolving symbol LOCAL_STORAGE_SERVICE_CONFIG in ....
This is the point where I find myself completely lost.
The problem seems to be related to the deprecation of OpaqueToken as discussed here. However, my project is based on Angular 2, not 4.
So, am I overlooking something? Could this be due to a mismatch in the angular cli version? I am unsure where to look for a solution!
Here is a snippet from my package.json
that might offer some insight:
"devDependencies": {
"@angular/compiler-cli": "^2.0.0",
"@angular/platform-server": "2.0.0",
"@angular/tsc-wrapped": "0.3.0",
"@types/async": "2.0.31",
"@types/core-js": "0.9.32",