Custom Operators
filterNilValue
Filters undefined
or null
values:
import { filterNilValue } from '@datorama/akita';
query.selectEntity(1).pipe(filterNilValue()).subscribe();
setLoading
set the loading
property to true
and change it to false
when the request completed or there was an error:
products.service.ts
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))
);
}
}