Is it possible to use Ngxs in a standalone component? I've tried importing the NgxsModule
in the following ways:
@Component({
...
imports: [
...
NgxsModule.forFeature([MyState]),
...
and
@Component({
...
imports: [
...
NgxsModule.forRoot([MyState]),
...
But both give me the following error message: Type 'ModuleWithProviders<NgxsFeatureModule>' is not assignable to type 'any[] | Type<any>'
(or NgxsRootModule
in the forRoot
case). A more in-depth error message is available as well: 'imports' contains a ModuleWithProviders value, likely the result of a 'Module.forRoot()'-style call. These calls are not used to configure components and are not valid in standalone component imports - consider importing them in the application bootstrap instead.
Is this supported and I have the syntax wrong? Or is this not supported? If not supported, what's the blocker?