I got into an error with Akita state management implementation on the Angular project. I will just provide a short answer in order for some people like me could resolve this issue.
There is no clear understanding of this in Akita docs and examples.
export interface ItemState extends EntityState<Item> {}
@StoreConfig({ name: 'items' })
export class ItemsStore extends EntityStore<ItemState> {
constructor() {
super();
}
}
I receive error: StaticInjectorError(Platform: core)[ItemsService -> ItemsStore]: NullInjectorError: No provider for ItemsStore!
It should work
It is not mentioned in docs, but in order for this to work we just need to add provideIn: 'root'
export interface ItemState extends EntityState<Item> {}
@Injectable({
providedIn: 'root'
})
@StoreConfig({ name: 'items' })
export class ItemsStore extends EntityStore<ItemState> {
constructor() {
super();
}
}
Same is for ItemsQuery. Hope this was helpful for somebody