Skip to content

Instantly share code, notes, and snippets.

@ssougnez
Created December 22, 2022 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssougnez/a2f5b21a717b594066ef894e0f564cd2 to your computer and use it in GitHub Desktop.
Save ssougnez/a2f5b21a717b594066ef894e0f564cd2 to your computer and use it in GitHub Desktop.
import { inject, Injectable } from "@angular/core";
import { NgStore } from "@ssougnez/ng-store";
import { Observable } from "rxjs";
import { Pokemon } from "../models/pokemon.model";
import { AppState } from "../state/app.state";
@Injectable({
providedIn: 'root'
})
export class PokemonService {
private _store: NgStore<AppState> = inject(NgStore);
public loadPokemons(): Observable<Pokemon[]> {
return this._store.loadAllEntities('http://localhost:3000/pokemons', s => s.pokemons);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment