Custom Operators

  • filterNil

import { filterNil } from '@datorama/akita';
this.query.selectEnitity(1).pipe(filterNil); // filter undefined or null
  • setLoading: set the loading property to true and change it to false when the request completed or there was an error.

import { setLoading } from '@datorama/akita';
export class ProductsService {
constructor(private productsStore: ProductsStore) {}
getProducts() {
return this.http.get(url).pipe(
setLoading(store),
tap(response => this.productsStore.set(response))
);
}
}