Created
December 22, 2022 21:18
-
-
Save ssougnez/a2f5b21a717b594066ef894e0f564cd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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