After upgrading to AngularCli9 ngx / cache does not work

Posted May 28, 20201 min read

Keyword

"Can't resolve all parameters for MemoryCacheService"
"Can't resolve all parameters for LocalStorageService"

Problem Description

After upgrading to AngularCli 9, the above problems will occur after the ngx-cache module is added

solution

The injection method is

{provide:CACHE, useClass:(MemoryCacheService)}

To

{provide:CACHE, useClass:(MemoryCacheService), deps:[PLATFORM_ID]}

In fact, it adds PLATFORM_ID as a parameter

Details are in Angular 9 + Ivy # 128