Does the Angular resource API support adding an initial value for the resource?

Discussão em 'Angular' iniciado por Ole, Janeiro 2, 2025.

  1. Ole

    Ole Guest

    Suppose we first check whether a resource is not loading like this:

    @if (!countriesResource.isLoading()) {
    <ul>
    @for (
    country of countriesResource.value();
    track country.name.official
    ) {
    <li>{{ country.name.official }}</li>
    }
    </ul>


    If the resource is not loading, however has not initiated a request yet, is there a way to provide an initial value so that countriesResource.value() resolves to an initial value?

    Continue reading...

Compartilhe esta Página